Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Objective-C: If string contains...? [duplicate]

How can I tell if a string contains something? Something like:

if([someTextField.text containsString:@"hello"]) {

}
like image 276
Bob Avatar asked Nov 28 '22 08:11

Bob


1 Answers

You could use:

if ( result && [result rangeOfString:@"hello"].location != NSNotFound ) {
    // Substring found...
}
like image 184
mvds Avatar answered Dec 17 '22 17:12

mvds