I am receiving a string from server in this format:
0_1_2_3
My task is to select for digits from this string to fill four labels with them.
First idea was:
NSString *res1 = [result substringWithRange:NSMakeRange(0, 1)];
[firstLabel setText:res1];
four times with appropriate labels.
But operation will repeats many times and every time I will receive a string with increased digit values. So when every digit be a decimal this code will not work. So how can I track every digit independently from their length in a proper way?
NSStringcomes with a convenience method called-componentsSeparatedByString: