aspose file tools*
The moose likes I/O and Streams and the fly likes Reading a single value from a pipe delimited dat file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Reading a single value from a pipe delimited dat file" Watch "Reading a single value from a pipe delimited dat file" New topic
Author

Reading a single value from a pipe delimited dat file

rastas biggs
Ranch Hand

Joined: Sep 24, 2004
Posts: 41
I have a text file in need to get a value from in this case

0409531354|False|Residential

How do I get the value I want from the file like the boolean value false

I can read the file ok but what implimentation is available to scan the value I'm after







Does someone have some example code

RB
[ November 03, 2004: Message edited by: rastas biggs ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You're in a good place after reading a whole line. If you're in JDK 1.4 or later, check the JavaDoc for String.split(). That will give you an array of strings, one for each segment of your line. If you're in an earlier JDK, look at StringTokenizer. That will let you fetch one segment at a time.

Be sure to test your code with missing values like: 0409531354||Residential

Hope that helps!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading a single value from a pipe delimited dat file