Operation On String

Concat 2 or more string

NSString *firstName=@"Rajneesh";
NSString *lastName=@"Tailor";

NSString *fullName = [NSString stringWithFormat:@"%@ %@",firstName,lastName];

//OutPut >> Rajneesh Tailor 


NSString *fullName2 =[firstName stringByAppendingString:lastName];

//OutPut >> RajneeshTailor  (if you don't want space between both)


****************************http://rajneesh071.blogspot.in/****************************

Component Separate by String 

NSString *string = @"Rajneesh,Iphone Developer";

NSArray *separateStringsAry = [string componentsSeparatedByString:@","];

NSLog(@"%@",[separateStringsAry objectAtIndex:0]); //OutPut : Rajneesh
NSLog(@"%@",[separateStringsAry objectAtIndex:1]); //OutPut : Iphone Developer







Comments

Popular posts from this blog

Launch iPhone simulator without Xcode.

How to Make REST api call in Objective-C.

id vs NSObject