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

Hacker Rank problem solution

How to Make REST api call in Objective-C.

Building and Running Python Scripts with Xcode