Re: Parsing NSString
Re: Parsing NSString
- Subject: Re: Parsing NSString
- From: Henry Maddocks <email@hidden>
- Date: Tue, 25 Jan 2005 19:12:35 +1300
On 25/01/2005, at 7:02 PM, Seth A. Roby wrote:
On Jan 24, 2005, at 6:17 PM, Henry Maddocks wrote:
<x-tad-bigger>- (</x-tad-bigger><x-tad-bigger>NSArray</x-tad-bigger><x-tad-bigger> *)componentsSeparatedByString:(NSString *)</x-tad-bigger>separator
But...
NSString* argList = @"command arg1 arg2 \t arg3 \t\targ4";
[argList componentsSeparatedByString:@" "];
// yields: @"arg1", @"arg2", @"\t", @"arg3", @"\t\targ4"
[argList componentsSeparatedByString:@"\t"];
// yields: @"arg1 arg2 ", @" arg3 ", @"", @"arg4"
There's no (easy) way to do a componentsSeperatedByAnyOfTheseStrings:, unfortunately.
Apart from maybe an NSScanner...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden