• 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: Clark Cox <email@hidden>
  • Date: Sat, 7 Feb 2004 11:16:59 -0500

On 2004/02/07, at 10:03, Rogier Bosch wrote:

> 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];

Try this instead:
NSScanner *rowscan = [[NSScanner alloc] initWithString:row];
[rowscan setCharactersToBeSkipped: [NSCharacterSet
characterSetWithCharactersInString: @""]];

>
> 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.
>

--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[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: Ali Ozer <email@hidden>
References: 
 >RE: [Q] NSScanner -> \t\t how to fix?? (From: "Jonathan E. Jackel" <email@hidden>)
 >Re: [Q] NSScanner -> \t\t how to fix?? (From: Rogier Bosch <email@hidden>)

  • Prev by Date: Code -NSSavePanel, background-only app, "Replace?" alert ordering
  • Next by Date: Re: Etched Text
  • 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