Alex Rivera | Logout

How do you detect words that start with “@” or “#” within an NSString?

Asked 2012-04-27T15:34:59.523
8

I'm building a Twitter iPhone app, and it needs to detect when you enter a hashtag or @-mention within a string in a UITextView.

How do I find all words preceded by the "@" or "#" characters within an NSString?

Thanks for your help!

Edit
Report

1 Answer

0
if([[test substringToIndex:1] isEqualToString:@"@"] ||
   [[test substringToIndex:1] isEqualToString:@"#"])
{
    bla blah blah
}
answered 2012-04-27T15:40:55.963

Your Answer