• 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: NSString Parsing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString Parsing


  • Subject: Re: NSString Parsing
  • From: "Andrew M. Salamon" <email@hidden>
  • Date: Tue, 29 Oct 2002 15:22:34 -0800

On Monday, October 28, 2002, at 08:01 AM, Peer Allan wrote:
...
What I want to do is extract all the text from in between a pair or tags
(<td>...</td> for example). I know I could use a rangeOfString: call to get
the first one, but then I have to create a new string with the remaining
data and call rangeOfString: again to get the next and on and on until the
whole string is parsed. I hope there is a better way to do this.


You could use - (NSRange)rangeOfString:(NSString *)subString options:(unsigned)mask range:(NSRange)aRange, which at least eliminates the need to create a new string each time. Just bump the range up each time and do two searches, one for '<td' and another for '</td>'.

Andrew

P.S. I left the ending '>' off in case the td tag had attributes, but that's probably better handled by regex...
_______________________________________________
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.
References: 
 >NSString Parsing (From: Peer Allan <email@hidden>)

  • Prev by Date: (no subject)
  • Next by Date: Custom Controls and Controllers: Some funny stuff going on here, any ideas?
  • Previous by thread: Re: NSString Parsing
  • Next by thread: Re: NSString Parsing
  • Index(es):
    • Date
    • Thread