i have an NSString like "Hello - this is me". I want to search for the "-" and put the text before and after the "-" in two separate strings.
Anyone knows how to do that the best way?
greets Max
NSString *myString = @"123-456-789-1234-2345-3456-4567";
NSArray *subStrings = [myString componentsSeparatedByString:@"-"];
for (int i = 0; i < [subStrings count]; i++) {
NSLog(@"string on array position %d is : %@", i, [subStrings objectAtIndex:i]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With