Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSString *) convertToHtml1:(NSString *)bruteText
- {
- //////////////////////// REPLACING @ with <b> </b> //////////////////////////
- NSString *rezultat = [NSString stringWithString:@""];
- NSArray *splits = [bruteText componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"@"]];
- NSMutableArray *modifiedArray = [[NSMutableArray alloc] initWithCapacity:[splits count]] ;
- int i;
- for (i=0;i< [splits count];i++ )
- {
- if (i%2==0)
- {
- [modifiedArray addObject: [splits objectAtIndex:i]];
- }
- if (i%2!=0)
- {
- NSString *alteredText=[[NSString alloc] init];
- if (i==1)
- {
- alteredText = [NSString stringWithFormat:@"%s %@ %s", "<span style=\"font-size:22px; color:blue; font-weight:bold; text-transform:lowercase \" >", [splits objectAtIndex:i], "</span>" ];
- }
- if (i>=3)
- {
- alteredText = [NSString stringWithFormat:@"%s %@ %s", "<b>", [splits objectAtIndex:i], "</b>"];
- }
- [modifiedArray addObject:alteredText];
- [alteredText release];
- }
- }
- for (i=0;i< [modifiedArray count];i++)
- {
- rezultat = [rezultat stringByAppendingString:[NSString stringWithFormat:@"%@", [modifiedArray objectAtIndex:i]]];
- }
- return rezultat;
- }
Add Comment
Please, Sign In to add comment