Search Results

Search found 1 results on 1 pages for 'kyriakos leivadas'.

Page 1/1 | 1 

  • How to remove all of the html whitespace/newlines of a NSString

    - by Kyriakos Leivadas
    i've got a problem and i hope someone can solve it. I parsed some html to a nsstring and im trying to trim all of the characters and keep some specific words. The problem is that i trimmed all the characters from the nsstring that i didnt want but the weird thing is that i cant get rid of all the whitespace. i used all the techniques i read from other answers but still some whitespace remains. here is my code -(void)requestFinished:(ASIHTTPRequest *)request{ NSString *htmlData = [request responseString]; NSCharacterSet *garbage = [NSCharacterSet characterSetWithCharactersInString:@"qazwsxedcrfvtgbyhnujmik,ol.p;/[]'QAZWSXEDCRFVTGBYHNUJMIKOLP()\"-1234567890#{}=:+_&!`<>"]; //im doing this to remove all characters except non-english chars htmlData = [htmlData compomentsSeparatedByCharactersInSet:garbage ]compomentsJoinedByString:@""]; htmlData = [htmlData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; htmlData = [htmlData stringByReplacingOccurencesOfString:@"[\n\t\r ]+" withString@""]; htmlData = [htmlData stringByReplacingOccurencesOfString:@" " withString:@""]; NSLog(@"%@",htmlData); } i get this result: nonenglishwordsnonenglishwords nonenglishwordsnonenglishwords (whitespace or new lines in middle remains) thank you.

    Read the article

1