Single specific string replace method Objective C
- by Sam
Hi guys,
I wanted to know if theres a single method or way that will help me replace strings for specific characters.
like MALE - M
FEMALE - F
CHILD - P
The longer way out is this..
[str stringByreplacingOccurencesOfString:@"MALE" withString:@"M"];
[str stringByreplacingOccurencesOfString:@"FEMALE" withString:@"F"];
[str stringByreplacingOccurencesOfString:@"CHILD" withString:@"P"];
I was wondering if theres another way in which i can reduce lines of code here, specially when there are alots of things to replace.
thanks.
this is for iPhone OS.