I wonder how could I able to find all the numbers as follows.
Input
NSString* input = @ "1m3s"
The desired output
@[@"1" @"3"]
I have tried the following approach
NSArray *arr = [input componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"ms"]];
it returned me
@[@"1",@"3",@"@"]
Is there a better approach to solve this problem, any suggestion?
Even though this question has been marked as a duplication, I have tested the following answer but did not work.
Update
That could be any string value.
if input is @"11m32s"
or @11m32
and then desired output would be @[@"11", @"32"];
if input is @"11x32"
or @11x32y
and then desired output would be @[@"11", @"32"];