Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Quick question on StreamTokenizer
How do I prevent StreamTokenizer from returning any TT_NUMBER items?
Basically all I want is to have a steady stream of plain TT_WORD items,
even if they're all digits. I tried wordChars('0', '9') but to no avail.
Thanks in advance.

Report this thread to moderator Post Follow-up to this message
Old Post
overbored
09-20-04 02:04 PM


Re: Quick question on StreamTokenizer
"overbored" <overboredNO@SPAMoverbored.net> schreef in bericht
 news:Xns956A1896DF4Eyangstaoverbored@127
.0.0.1...
> How do I prevent StreamTokenizer from returning any TT_NUMBER items?
> Basically all I want is to have a steady stream of plain TT_WORD items,
> even if they're all digits. I tried wordChars('0', '9') but to no avail.

This will just assign a group of chars to two types.  Try calling
resetSyntax() first.



Report this thread to moderator Post Follow-up to this message
Old Post
Boudewijn Dijkstra
09-20-04 09:03 PM


Re: Quick question on StreamTokenizer
But won't that clear out *everything*? Then I'd have to rebuild the entire
table, and I would have to do research into locales and character sets and
whatnot.... Is there no alternative?

"Boudewijn Dijkstra" <usenet@bdijkstra.tmfweb.nl> wrote in news:414f23dc$0
$62354$5fc3050@dreader2.news.tiscali.nl:

> "overbored" <overboredNO@SPAMoverbored.net> schreef in bericht
>  news:Xns956A1896DF4Eyangstaoverbored@127
.0.0.1... 
>
> This will just assign a group of chars to two types.  Try calling
> resetSyntax() first.
>
>
>


Report this thread to moderator Post Follow-up to this message
Old Post
overbored
09-21-04 02:03 AM


Re: Quick question on StreamTokenizer
overbored <overboredNO@SPAMoverbored.net> wrote in message news:<Xns956A1896DF4Eyangstaover
bored@127.0.0.1>...
> How do I prevent StreamTokenizer from returning any TT_NUMBER items?
> Basically all I want is to have a steady stream of plain TT_WORD items,
> even if they're all digits. I tried wordChars('0', '9') but to no avail.
> Thanks in advance.

When you get TT_NUMBER, convert it to a String and concatenate all
strings and numbers into one string

Regards,
Yakov

Report this thread to moderator Post Follow-up to this message
Old Post
Yakov
09-21-04 09:02 AM


Re: Quick question on StreamTokenizer
"overbored" <overboredNO@SPAMoverbored.net> schreef in bericht
 news:Xns956A8F336687Fyangstaoverbored@12
7.0.0.1...
> "Boudewijn Dijkstra" <usenet@bdijkstra.tmfweb.nl> wrote in news:414f23dc$0
> $62354$5fc3050@dreader2.news.tiscali.nl:
> 

> But won't that clear out *everything*? Then I'd have to rebuild the entire
> table, and I would have to do research into locales and character sets and
> whatnot....

That is what you might expect in Java, but quite the opposite is true:
StreamTokenizer isn't very advanced.  It says in the docs: "Each byte read
from the input stream is regarded as a character in the range '\u0000' throu
gh
'\u00FF'."  So there are only 256 characters to be reckoned for.

> Is there no alternative?

I just read in the docs that the ordinaryChars() method does the same as
resetSyntax(), but only with the specified characters.

Remember this: javadoc is your friend.



Report this thread to moderator Post Follow-up to this message
Old Post
Boudewijn Dijkstra
09-22-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:20 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.