i am convert paragraph into words it contains many special characters like
\" , \" . `
how to remove this characters in nsstring and get
There are numerous ways of dealing with this. As an example, here's a solution using regular expressions. This is just an example. We don't know the entire range of special characters that you want to remove.
#import
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"[,\\.`\"]"
options:0
error:NULL];
NSString *sampleString = @"The \"new\" quick brown fox, who jumped over the lazy dog.";
NSString *cleanedString = [expression stringByReplacingMatchesInString:sampleString
options:0
range:NSMakeRange(0, sampleString.length)
withTemplate:@""];
printf("cleaned = %s",[cleanedString UTF8String] );
}
return 0;
}