Re: Fastest/smallest search+replace
Re: Fastest/smallest search+replace
- Subject: Re: Fastest/smallest search+replace
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 14 May 2001 15:16:40 -0700
On Monday, May 14, 2001, at 02:01 PM, Ali Ozer wrote:
In any case, looks like this might be good functionality to include in
NSString.
Yes, and while you're at it, how about a good selection of the rest of
the string-bashing functionality that Perl or Python offer? In
particular, the tr/// operator would be *very* nice to have, and a
"NSRegex" class that kept the compiled expressions around would be a
nice addition to the NSScanner functionality.
nameExpression = [[NSRegex alloc] initWithPattern:@"[A-Za-z]*"];
[myScanner scanPattern:nameExpression intoString:&nameString];
[myMutableString searchForPattern:nameExpression
andReplaceWithString:@"Some Other Name"];
-jcr
[Objc retain];