Forums Register Login

finding token data type (StringTokenizer)

+Pie Number of slices to send: Send
Does anyone know how to find the data type of
st.nextToken in the code below? I can't use
streamTokenizer's TT_WORD or TT_NUMBER b/c need
to parse words like G7790 that have both #s and
letters and streamTokenizer gets confused. Need something specific to stringTokenizer. Searched Sun's page w/ no luck. TIA

[ January 29, 2002: Message edited by: Cindy Glass ]
+Pie Number of slices to send: Send
What do you WANT G7790 to parse to?
Have you looked into using a StringTokenizer, perhaps inside the StreamTokenizer calls?
+Pie Number of slices to send: Send
Cindy,
Thanks for the reply.
I need to find out what tokens are doubles
and put them in the data1 array. Anything else
(like G7889) goes into the name1 array.
I've used StreamTokenizer in an earlier version,
and something like G7889 gets split up into G and 7889 which I don't want. So am not sure about
using again and trying to put StringTokenizer
inside it.
Pip
+Pie Number of slices to send: Send
Oh, I think that I get it.
Can't you just use StringTokenizer, and then check each token to see if you can Long.parseLong(st.nextToken()) and if it pulls a NumberFormatException - then put it in as a String?
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1367 times.
Similar Threads
using doubleToString
Compare Two Text Files
reverse the text file and write
putting screen output inside scroll bar
sting tokenizer in a loop(vv urgent)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:33:06.