If you have a string:
NSString *string = @"New Windsor,New York,USA";
You can split it by using a delimiter, in this case a comma ,
NSArray *splitStrings = [string componentsSeparatedByString:@","];
This will give you an array with 3 strings: New Windsor
, New York
, and USA
. You can then manipulate and/or display these however you like. You can then manipulate and/or display these however you like. For example:
NSString *newString = [NSString stringWithFormat:@"%@,%@", splitStrings[1], splitStrings[2]]; // Would equal "New York,USA"
solved Splitting string into substring objective c