-
to select certain details from text file
hi,
i was wondering how can i select n display only certain items from the text file. lets say i have name , address, birthdate, location in the file.
However, i would only like to retrieve the address. how can i do that? thanks
currently i have managed to select out all the info by using this following codes.
File inputFile = new File("C:\\temp\\test.txt");
try{
FileReader in= new FileReader(inputFile);
int c;
String str;
while ((c = in.read()) != -1) {
System.out.print((char) c);
}
in.close();
}catch (FileNotFoundException e){
System.out.println("File Does not exist");
System.exit(1);
-
what does the data in the file look like?
is it something like:
"Name: John
Address: 123 something st.
Birthdate: 12/3/78"
or is it something else?
-
it looks like this.
name age location
john 13 usa
peter 14 au
jane 15 seoul
lets say i would only like to select out the age.how do i do tht?
thanks
-
The Scanner class is designed to perform the very task you are looking at.
-
where can i find it?
thanks
-
Similar Threads
-
By srinivasc_it in forum .NET
Replies: 5
Last Post: 08-18-2006, 01:15 PM
-
Replies: 146
Last Post: 08-12-2002, 10:40 PM
-
By Hian Chew in forum VB Classic
Replies: 18
Last Post: 03-07-2001, 12:07 PM
-
By Hian Chew in forum VB Classic
Replies: 0
Last Post: 03-06-2001, 12:28 PM
-
By deborah in forum authorevents.kurata
Replies: 0
Last Post: 04-17-2000, 01:33 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks