开发者

How to remove space/blank between any two words using RegexKitLite?

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜