• 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 bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScanner bug?


  • Subject: Re: NSScanner bug?
  • From: Jérôme Laurens <email@hidden>
  • Date: Tue, 22 Oct 2002 15:54:36 +0200

Le mardi, 22 oct 2002, ` 14:56 Europe/Zurich, Mark's Studio a icrit :

I am trying to scan a text file, and i use this

if([theScanner scanUpToString:@"ABC" intoString:NULL])

if the textfile contains "ABC" at the beginning the scanner will not
find it, and it will not find the next "ABC".

BUG???


no,

the doc says that this method returns YES if some characters have been scanned NO otherwise.
It stops just before the stopString!

you can code like this

if([theScanner scanUpToString: @"ABC" intoString: nil], [theScanner scanString: @"ABC" intoString: nil])
{
//do your job
}

or

if([theScanner scanUpToString: @"ABC" intoString: nil], ![theScanner isAtEnd])
{
[theScanner setScanLocation: [theScanner scanLocation]+3];// 3 for [@"ABC" length]
//do your job
}

it is not very efficient...
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSScanner bug?
      • From: "Mark's Studio" <email@hidden>
References: 
 >NSScanner bug? (From: "Mark's Studio" <email@hidden>)

  • Prev by Date: NSScanner bug?
  • Next by Date: Jag Screen Savers not 10.1.x Compatible?
  • Previous by thread: NSScanner bug?
  • Next by thread: Re: NSScanner bug?
  • Index(es):
    • Date
    • Thread