Try the following:
NSArray *arrayWithTwoStrings = [yourString componentsSeparatedByString:@"."];
Using this method, you will get an NSArray containing string components separated by the "." string, that is, "112" and "1" for the string "112.1". After that, you can access them using the array method objectAtIndex:.
PS Also note that if you intend to use the numerical values โโof these strings, there may be a better solution.
source
share