开发者

get all hyperlinks in array of uitextview in iphone sdk?

I have a UITextView in which i have 5 hyperlinks and 5 phone number开发者_运维百科s.How do i get all those hyperlinks and phone numbers in a NSarray?


One option is to use RegexKitLite's componentsMatchedByRegex: method. You can then use a regular expression to find the appropriate parts of the text, and you'll get the results returned as an array.

You can use RegExr to experiment with your specific regular expressions, and use the "Community" to find pre-built regular expressions that find phone numbers and hyperlinks. (They're there, I checked!)

RegexKitLite compiles right into your app, so there's no problem using it on the iPhone. Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜