Single specific string replace method Objective C
Posted
by Sam
on Stack Overflow
See other posts from Stack Overflow
or by Sam
Published on 2010-04-17T00:00:51Z
Indexed on
2010/04/17
0:03 UTC
Read the original article
Hit count: 396
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.
© Stack Overflow or respective owner