| | |
Extract field from text file
![]() |
•
•
Join Date: Apr 2006
Posts: 114
Reputation:
Solved Threads: 0
Hello all,
I wondering if anyone could tell me how to go about extracting a single field from a text file.
The file is all follows:
Jeff 8.00 8.9900 hadk
Kim 234.0 234 hak
Him 444.8 1.11 john...
How would I extract only the first column without using tokenizer or split?
Thank you,
I wondering if anyone could tell me how to go about extracting a single field from a text file.
The file is all follows:
Jeff 8.00 8.9900 hadk
Kim 234.0 234 hak
Him 444.8 1.11 john...
How would I extract only the first column without using tokenizer or split?
Thank you,
Last edited by KimJack; Sep 9th, 2007 at 7:56 pm. Reason: error
Serialilzation is solution to your question. Try to read this tutorial from Java How to Program
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
I can't see why you need to avoid split, but Scanner and java.util.regex are other options for parsing your input.
•
•
Join Date: Apr 2006
Posts: 164
Reputation:
Solved Threads: 10
you can use FileReader... here is the documentation for j2se 5: http://java.sun.com/j2se/1.5.0/docs/...ileReader.html
A Perfect World
> Serialilzation is solution to your question.
Serialization is a completely different beast. In serialization, you serialize i.e. persist an object onto the secondary storage and read them again as and when required. Here the user is presented with a simple text file so the only option is to read the file using the File streams or readers and parsing the content as required.
Serialization is a completely different beast. In serialization, you serialize i.e. persist an object onto the secondary storage and read them again as and when required. Here the user is presented with a simple text file so the only option is to read the file using the File streams or readers and parsing the content as required.
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- how can we sort data from text file (C++)
- text file strings help (Visual Basic 4 / 5 / 6)
- Text File Editing Help Required. (Windows NT / 2000 / XP)
- read text file (C)
- conversion of text file into data base file (Visual Basic 4 / 5 / 6)
- using a "for" loop to read a text file (VB.NET)
- Read and write to an ASCII Text file (Java)
Other Threads in the Java Forum
- Previous Thread: Help me with my wierd applet please.
- Next Thread: connection mysql
| Thread Tools | Search this Thread |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows






