• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Parsing NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing NSString


  • Subject: Re: Parsing NSString
  • From: Martin Valenta <email@hidden>
  • Date: Tue, 25 Jan 2005 12:31:57 +0100

You can use OgreKit (http://www-gauge.scphys.kyoto-u.ac.jp/~sonobe/OgreKit/). OgreKit is a regular expressions framework that has a method called:

- (NSArray*)componentsSeparatedByRegularExpressionString:(NSString*)expressionString;

Having a string like this:

NSString* argList = @"command arg1 arg2 \t arg3 \t\targ4";

you can parse it for example that way:

[argList componentsSeparatedByRegularExpressionString: @"[ \t]*"

this yields the array:

@"command", @"arg1", @"arg2", @"arg3", @"arg4"

There's no (easy) way to do a componentsSeperatedByAnyOfTheseStrings:, unfortunately.

Fortunately there is an easy way ;-)

Some information about regular expressions and a tutorial as a starting point can be found here: http://regular-expressions.info/
 _______________________________________________
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

  • Follow-Ups:
    • Re: Parsing NSString
      • From: "Michael A. Crawford" <email@hidden>
References: 
 >Parsing NSString (From: "Michael A. Crawford" <email@hidden>)

  • Prev by Date: NSMenuItem +separatorItem. Separator showing a line programatically.
  • Next by Date: Re: mathematical area of closed vector path
  • Previous by thread: Re: Parsing NSString
  • Next by thread: Re: Parsing NSString
  • Index(es):
    • Date
    • Thread