Re: String subtraction
Re: String subtraction
- Subject: Re: String subtraction
- From: Greg Weston <email@hidden>
- Date: Tue, 25 Mar 2003 07:48:49 -0500
On Tuesday, March 25, 2003, at 01:00 AM, Andrew Merenbach
<email@hidden> wrote:
What is the best way to subtract characters in a given set from a
string? For example, I might wish in one instance to remove the
letters "e," "o," and "h" from "hello, world," yielding "ll, wrld."
Others have already suggested alternative implementations, but as for
why your attempted reimplementation of the JavaScript fails...
NSString *c1 = [s1 substringWithRange:NSMakeRange(i-1,i)];
The second argument to NSMakeRange is not the end of the range; it's
the length. If I'm reading the intent correctly, you always want that
to be 1.
G
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.