iOS: Remove Leading and Trailing Whitespaces in NSString Object
This tip is especially useful because users might not notice the extra whitespace characters at the start and end of their text when they type into your text fields. The following code snippet will allow you to do that in iOS: NSString *newString = [someString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; You may use [NSCharacterSet whitespaceCharacterSet] if you do… Read More iOS: Remove Leading and Trailing Whitespaces in NSString Object