Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Strings
//gcc 5.0.4 #import<Foundation/Foundation.h> @interface SampleClass:NSObject { } +(void)stringMethod; @end @implementation SampleClass +(void)stringMethod { NSString *str=@"Raju"; NSLog(@"String is: %@",str); NSString *name=[str stringByAppendingString:@"kesava"]; NSLog(@"name is:%@",name); NSUInteger len=[name length]; NSLog(@"name length is:%lu",len); if ([name isEqualToString:name]) { NSLog(@"Both are same"); } else { NSLog(@" Both are not same"); } if ([name hasPrefix:@"kesava"]) { NSLog(@"The given string starts with:%@",str); } else { NSLog(@"The given string not starts with:%@",str); } if ([name hasSuffix:@"Raju"]) { NSLog(@"The given string ends with same:%@",name ); } else { NSLog(@"The given string not ends with same:%@",str); } NSString *strobj=@"10"; NSLog(@"string is:%@",strobj); int strInt=[strobj intValue]; NSLog(@" string to integer:%d",strInt); NSString *intstr=[NSString stringWithFormat:@"%d",strInt]; NSLog(@"Integer to string:%@",intstr); NSString *upperstr=[name uppercaseString]; NSLog(@" uppercase format is :%@",upperstr); NSString *lowerstr=[name lowercaseString]; NSLog(@"Lowercae format is:%@",lowerstr); } @end int main(int argc, const char * argv[]) { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init]; [SampleClass stringMethod]; return 0; }
run
|
edit
|
history
|
help
0
geomatric operations in objective c
string divison
string
array
Even numbers are at the beginning and all the Odd numbers
Program 2.1
find maximum in objective c
Class implementation
inheritenace-test
Uso de else if