//Remove spaces from both ends of a string
NSString *resultString = [yourString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];
//To Remove spaces and newlines from the string, use the whitespaceAndNewlineCharacterSet
NSString *resultString = [yourString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
No comments:
Post a Comment
Kamleshwar