 <p>Use this code to remove the white space:</p> <pre><code>NSString *str = @"this string contains blank spaces"; NSString *newStr = [str stringByReplacingOccurrencesOfString:@" " withString:@""]; </code></pre>