AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

StreamTokenizer or Replacement suggestion?

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Eric Azarcon
Guest





PostPosted: Tue Jan 27, 2004 5:27 pm    Post subject: StreamTokenizer or Replacement suggestion? Reply with quote




All,

I either need help with StreamTokenizer, a suggestion for a replacemnt
library (commercial or free) that will accomplish the same thing.

I have no problem using StreamTokenizer to read files. These files may
be delimited in typical fashion (tab, comma, etc). They may or may not
have quoted text.

I am having no problem reading the file, EXCEPT when the text is not
quoted. It looks like StreamTokenizer is trying to convert it into a
number. Quoted-String, tab delimited does fine. Quoted-string comma
delimited is fine.

Any unquoted string fails.

What setting am I missing to allow me to read a string as a string,
even if it is unquoted? Do I set quoteChar('') to empty?

A file will either contain quoted-strings or unquoted strings, but not
a mixture of both. Files are coming from disparate systems, so I have
no ability to normalize them to a single format (apart from writing to
preprocess the data of course!).

Thanks!

Eric
Back to top
Chris
Guest





PostPosted: Wed Jan 28, 2004 9:39 am    Post subject: Re: StreamTokenizer or Replacement suggestion? Reply with quote



Quote:
It looks like StreamTokenizer is trying to convert it into a number.

Are you sure?

If the 'string' is unquoted then StreamTokenizer *should* be returning
it as a series of white-space delimited words, which should be trivial
to re-constitute into a string when you get the next delimiter (say a
comma).

I've used this approach to handle ropey customer files that sometimes
have quoted strings and sometimes don't without any problems.

Maybe post the method that's loading the data file? Perhaps there's
something wrong with the way you've configured the tokenizer?

- sarge

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.