Re: Java StreamTokenizer



Everything you get from the STRINGTokenizer will be a string.

int oneTwoThreeFour = Integer.parseInt(token);

If you want to do that only for strings, use java.text.RegularExpressions to only convert tokens that are 100% numeric.



absinth@xxxxxxxxx wrote:
Hi,

The StreamTokenizer is perfect for what I want to do but am wondering,
how can I make the Tokenizer recognise another escape character apart
from '\'?

Also does anyone have any idea on how to have the tokenizer parse in
white space into strings?

For example say I delimit a field with |:
Hello World|1234

I want the tokenizer to parse in "Hello World" as a string token and
"1234" as an integer.

.



Relevant Pages

  • Re: Please, please, please Help !!!
    ... I have a set of 100,000 ascii strings, up to 255 chars each. ... Each string has 1 or more words (tokens), ... if I have strings in: mary poppins, brad pitt, yygr ...
    (microsoft.public.sqlserver.xml)
  • Re: Stupid Newbie Needs Help
    ... Without the loop the program works fine with the ... with 0-terminated strings, that way you can take advantage of C's ... hold up to 10 tokens, where each token may be up to 80 characters ... should give a clue of how the variable/constant/function/macro is ...
    (comp.lang.c)
  • Use of symbols for "words" -- was Avoiding eval
    ... >using strings for your various categories rather than symbols. ... Some innocent looking tokens represent numbers so large lispworks 4.2 could ... What I think I need is a mechanism to cause lisp to interpret all tokens in context as ... typecase function on each of the arguments then somehow arrange for the ...
    (comp.lang.lisp)
  • Re: need an algo for string sorting
    ... I have to sort them. ... It really isn't a sorting problem, ... that, for example, "ax" is two tokens, but 'ai' is one token. ... you know the strings are unequal. ...
    (comp.programming)
  • (Heres how to do it) Re: Please help me with algorithms !!!
    ... FIRST PART (IDENTIFY YOUR ALGORITHM AND DATA STRUCTURE) ... You have 10,000 strings (you have to store them in something: ... Each string has 1 or more words (tokens), ... if I have strings in: mary poppins, brad pitt, yygr ...
    (comp.lang.c)