I'm wanting to remove a space between any two words and add anything that I want. For example, I'll have a string that has two words in it with a space between the two. I want to be able to remove the space and replace the space with something that I declare. Also, this needs to be written in objective-c or c.
NSString *string = @"Word Word2";
I'm needing an expression to do this and I can't seem to grasp Re开发者_如何学PythongexKitLite. Any help would be appreciated. Thanks
Use NSString
's stringByReplacingOccurrencesOfString:withString:
method:
NSString *spaceReplacement = @"whatever";
NSString *replaced = [string stringByReplacingOccurrencesOfString:@" " withString:spaceReplacement];
精彩评论