Re: HELP!! [self needsHelpWith:strings];
Re: HELP!! [self needsHelpWith:strings];
- Subject: Re: HELP!! [self needsHelpWith:strings];
- From: Jonathan Jackel <email@hidden>
- Date: Tue, 21 May 2002 11:51:10 -0400
Here's how I do it. You should also check out using NSScanners and
NSCharacterSets, as well as "Strings" in the Cocoa help topics.
- (NSMutableString *)strip:(NSString *)stripChar fromString:(NSString
*)theString
{
NSMutableString *strippedString = [[[NSMutableString alloc] init]
autorelease];
NSRange range;
int x;
int y = [stripChar length];
[strippedString setString:theString];
for (x = 0; x < [strippedString length] - y; x++)
{
range = NSMakeRange(x,y);
if ([[strippedString substringWithRange:range]
isEqualToString:stripChar])
{
[strippedString deleteCharactersInRange:range];
x--;
}
}
return strippedString;
}
Jonathan
on 5/21/02 11:14 AM, Christopher OBrien at email@hidden wrote:
>
Hi all. I am working on a major major project and I need to remove certain
>
characters from an NSString. Is it also possible to remove white space from
>
an NSString? All feedback is welcome and appreciated. Thanks.
>
_______________________________________________
>
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.
_______________________________________________
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.