I have a string "AA - The Title of the Person"
How can I get the part before the '-'?
The output should be "AA"
Also if the input doesn't have a '-' then output should be nil
I have a string "AA - The Title of the Person"
How can I get the part before the '-'?
The output should be "AA"
Also if the input doesn't have a '-' then output should be nil
NSInteger hyphenStart = [theString rangeOfString:@" - "].location;
if(hyphenStart == NSNotFound)
return nil;
return [theString substringToIndex:hyphenStart];