I Use RegexKitLite FrameWorks.
NSString *str = [NSString stringWithString:@"Welcome"];
NSString *newStr [NSString string];
//RegexKitLite.h reference.
newStr = [str stringByReplacingOccurrencesOfRegex:<How To Expression?> withString:@"?"];
I want “Welcome” convert to => “W??????”; More generally, for Apple , Banana Cake, Love, Peach, Watermelon… I want to covert
Apple => A????
Banana => B?????
Cake => C???
Love => L???
I Make a These Pattern (HeadLetter only Show)… All Word is Stored In NSMutableArray So I access
[arr objectAtIndex:i] stringByReplacingOccurrencesOfString:<Expression> withString:@"?"];
How to compare Second letter With RegularExpression?
You don’t need to use a regex for this. Simply do
For more options, also see the
NSStringmethodstringByReplacingOccurrencesOfString:withString:options:range:For the more general case you describe, this can be achieved by similar
NSStringmethods, e.g.