• 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: [Q] NSScanner -> \t\t how to fix??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] NSScanner -> \t\t how to fix??


  • Subject: Re: [Q] NSScanner -> \t\t how to fix??
  • From: Rogier Bosch <email@hidden>
  • Date: Sat, 7 Feb 2004 16:03:20 +0100

OK, that makes sence, but:

i have now, something like:
NString *row, *field;
// the row is filled with an other loop (ascii file row)

NSScanner *rowscan = [[NSScanner alloc] setCharactersToBeSkipped:nil];
[rowscan initWithString:row]; // setCharactersToBeSkipped:nil];
while ( [ rowscan scanUpToString:@"\t" intoString:&field] ) {
// do something
CFShow( field );
}


When i use the code above it doesnt return any field! :(

So whats wrong?

thx.

Roger


On 6-feb-04, at 19:58, Jonathan E. Jackel wrote:

> This is one of those hidden things in the docs. You can set which
> characters are skipped by the scanner. The default set of characters
> to
> skip is the whitespace and newline character set. Sneaky.
>
> To make sure characters are not skipped, use [scanner
> setCharactersToBeSkipped:nil], or construct a character set that has
> the
> characters you want skipped and doesn't have the ones you want scanned.
>
> Jonathan
>
>> -----Original Message-----
>> From: email@hidden
>> [mailto:email@hidden]On Behalf Of Rogier Bosch
>> Sent: Friday, February 06, 2004 8:26 AM
>> To: email@hidden
>> Subject: [Q] NSScanner -> \t\t how to fix??
>>
>>
>> Hay,
>>
>> When i use the NSScanner on a flat file, it skips double \t\t (tab
>> char).
>>
>> Is there anyway to NOT skip this char?
>>
>> I ask this because in the 1st line of the flat file i have the
>> columnnames. The next rows contains the data lines (just a CSV file).
>> So when parsing the file i do have the column-headers but i can't keep
>> it in sync with the data fields (since some fields are empty, e.a
>> \t\t).
>>
>>
>> Thanks,
>>
>> Rogier
>>
>> [demime 0.98b removed an attachment of type
>> application/pkcs7-signature which had a name of smime.p7s]
>> _______________________________________________
>> 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.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: [Q] NSScanner -> \t\t how to fix??
      • From: Clark Cox <email@hidden>
References: 
 >RE: [Q] NSScanner -> \t\t how to fix?? (From: "Jonathan E. Jackel" <email@hidden>)

  • Prev by Date: Re: Can't set image in NSImageView
  • Next by Date: NSTableView Row header
  • Previous by thread: RE: [Q] NSScanner -> \t\t how to fix??
  • Next by thread: Re: [Q] NSScanner -> \t\t how to fix??
  • Index(es):
    • Date
    • Thread