How to check if a string contains another string in xcode

 NSString *string = @"how to check if a string contains another string";

 if ([string rangeOfString:@"how"].location == NSNotFound) 
 {
     NSLog(@"Not found");
 } 
 else 
 {
     NSLog(@"Found");
 }

0 تعليقات

إرسال تعليق

Post a Comment (0)

أحدث أقدم
NERV Open Source

Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.

Explore NERV on GitHub →