How to replace the Space with UnderScore( _ ) in the array in objective C.
The following is the code i am using to read the array data from the file,
NSString *g = [[NSString alloc]initWithCString:data];
NSMutableString *tempGetAll = [[NSMutableString alloc]init];
if(k>0){
NSArray *lines = [g componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@""]];
for (NSString* line in lines)
{
//[arrGetAll addObject: line];
NSLog(@"%@",line) ;
//NSLog(@"---------");
}
}
k++;
The following is the output i am getting,
hi how r u 20.000
But i need the output in the following way,
hi_how_r_u:20.000
so how to replace the space with the Underscore.
There is a method
stringByReplacingOccurrencesOfString:withString:Result is