Replacing in NSString with wildcards / regular expressions - cocoa

為{幸葍}努か 提交于 2019-11-28 02:28:34

I'll assume you're looking for a solution in general -- not for this particular string. You'll want to learn about regular expressions.

For regular expression support in Objective-C check out RegexKitLite. It provides category methods on NSString that support various regex matching and substitution.

You could also use NSScanner on this quite easily. A quick read through this will give you all you need to know:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html#//apple_ref/doc/uid/20000147-BCIEFGHC

You could use straight C stuff. Here is a regex library allowing you to use NSString. This site has a small example of use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!