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

Re: NSScanner question


  • Subject: Re: NSScanner question
  • From: Michael Starke <email@hidden>
  • Date: Tue, 19 Mar 2013 15:27:26 +0100

If you cannot use single characterts as Needles to be able to use the scanUpToCharartersFromSet how about scanning for both strings and compare the prefixes in the results?

If you encounter one string in the other you know that you scanned for the second occurence at the first run and you can rescan or just remove the prefix?

Or am I thinking this the wrong way?

Another way might be to use NSString rangeOfString with NSRange.location you can then identify your first end second occurring Needle?

--Michael

On 19.03.2013 15:01, Koen van der Drift wrote:
I have the following string:   "this is a test AA string to capture BB and some more". I am using an NSScanner to extract the string to capture.  I scan up to AA, and then up to BB. However, sometimes, the string can be: "this is a test BB string to capture AA and some more". When I now use the scanner to scan for AA first, I will already be past my target string. Unfortunately, I do not know in advance if AA comes before BB or the other way around.

Any suggestions how to solve this with an NSScanner?


Thanks,

- Koen.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSScanner question
      • From: Koen van der Drift <email@hidden>
References: 
 >NSScanner question (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: Is there a way to access the native iOS Notes app to create new notes?
  • Next by Date: Re: NSScanner question
  • Previous by thread: NSScanner question
  • Next by thread: Re: NSScanner question
  • Index(es):
    • Date
    • Thread