Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
string compare
//gcc 4.8.4 #import <Foundation/Foundation.h> int main(void) { NSString *full_name = @"Parth M Ganatra"; NSString *name = @"Parth M Ganatra"; if ([full_name isEqualToString:name]) { NSLog(@"Both String Are Same"); } if ([full_name hasPrefix:@"Parth"]) { NSLog(@"Parth is prefix of full_name string "); } if ([full_name hasSuffix:@"Parth"]) { // This won't execute NSLog(@"parth is suffix of full_name string"); } else{ NSLog(@"parth is not suffix of full_name string"); } NSString *other_name = @"Lbc"; NSComparisonResult result = [full_name compare:other_name]; if (result == NSOrderedAscending) { NSLog(@"%@ is come after %@",other_name,full_name); } else if (result == NSOrderedSame) { NSLog(@"We're comparing the same string"); } else if (result == NSOrderedDescending) { NSLog(@"%@ is come before %@",other_name,full_name); } }
run
|
edit
|
history
|
help
0
shape example
arary
Az Flights Optimization
objective c fibonanci
find maximum in objective c
Class implementation using get method
abc
string mutable
NSString Examples in one
represent value