-
-
Save hfossli/4c76a96b34574cb938ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
NSString *string = @"123-456-7890"; | |
NSArray *components = [string componentsSeparatedByString:@"-"]; | |
NSLog(@"Components: (%i) %@", (int)components.count, components); | |
} | |
{ | |
NSString *string = @"-123-456-7890"; | |
NSArray *components = [string componentsSeparatedByString:@"-"]; | |
NSLog(@"Components: (%i) %@", (int)components.count, components); | |
} | |
{ | |
NSString *string = @"-123-456-7890-"; | |
NSArray *components = [string componentsSeparatedByString:@"-"]; | |
NSLog(@"Components: (%i) %@", (int)components.count, components); | |
} | |
{ | |
NSString *string = @"-123---456-7890-"; | |
NSArray *components = [string componentsSeparatedByString:@"-"]; | |
NSLog(@"Components: (%i) %@", (int)components.count, components); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components: (3) ( | |
123, | |
456, | |
7890 | |
) | |
Components: (4) ( | |
"", | |
123, | |
456, | |
7890 | |
) | |
Components: (5) ( | |
"", | |
123, | |
456, | |
7890, | |
"" | |
) | |
Components: (6) ( | |
"", | |
123, | |
"", | |
456, | |
7890, | |
"" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment