Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
NSString & MutableNSString Examples in one
//gcc 4.8.4 #import <Foundation/Foundation.h> int main(void) { NSMutableString *name = [NSMutableString stringWithString:@"PaRtH GaNaTra"]; NSString *collage = @" is studing in Atmiya"; NSLog(@"%@\n\n",name); NSLog(@"String In Lowercase %@ \n\n", [name lowercaseString]); NSLog(@"String In Uppercase %@ \n\n", [name uppercaseString]); NSLog(@"String With Capitalized String %@ \n\n", [name capitalizedString]); NSLog(@"String Length = %d \n\n", [name length]); NSLog(@"String Emuration "); int i; for (i=0; i<[name length]; i++) { char letter = [name characterAtIndex:i]; NSLog(@"%d: %c", i, letter); } NSLog(@"\n\n"); if ([name isEqualToString:@"Parth"]) { NSLog(@"Both String Are Same\n\n"); } else{ NSLog(@"Both String Are Not Same \n\n"); } if ([name hasPrefix:@"PaRtH "]) { NSLog(@"Yeah , It is My First Name \n\n"); } else{ NSLog(@"Sorry, It is Not \n\n"); } if ([name hasPrefix:@"GanaTra"]) { NSLog(@"Yeah , It is My Last Name \n\n"); } else{ NSLog(@"Sorry, It is Not Last Name of mine\n\n"); } [name appendString:collage]; NSLog(@"%@ \n\n",name); NSRange searchResult = [name rangeOfString:@"PaRtH"]; if (searchResult.location == NSNotFound) { NSLog(@"Search string was not found"); } else { NSLog(@"%@ starts at index %lu and is %lu characters long \n\n",@"PaRtH", searchResult.location, // 13 searchResult.length); // 6 } NSLog(@"%@\n\n", [name substringFromIndex:17]); name = [name stringByReplacingOccurrencesOfString:@"Atmiya" withString:@"Dholakiya"]; NSLog(@"%@\n\n",name); return 0; }
run
|
edit
|
history
|
help
0
Simple Arithmetic Operations in Objective C
basic arithmatic Opreation in objective C
datatype
nsset
NSString & MutableNSString Examples in one
Interface implementation
enheritance
01 Hola mundo
Convert String to NSData Json Object
Goldbach Conjecture