Posted: Wed May 23, 2007 5:14 am Post subject: How to search a string in between a file using Java
Apprentice
Joined: 09 Nov 2006 Posts: 33
i have a text file which contains many lines..
I have to search a string of length 9 from the last line, using the Java compute node and convert it into integer format.
How should i go about doing it ?
Posted: Fri May 25, 2007 12:32 am Post subject: How to search a string in between a file using Java
Apprentice
Joined: 07 Aug 2006 Posts: 48 Location: England
For a start
1. Use a BufferedReader class to read in your whole string.
2. call getline() to return each line
3. O the last line use the String class method "indexOf" to find the position of your string in that last line.
4. Then use substring method to get it.
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