The Artima Developer Community
Sponsored Link

Java Answers Forum
Stringtokenizer

1 reply on 1 page. Most recent reply: Jan 25, 2003 7:03 PM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
ben

Posts: 57
Nickname: loftty
Registered: Oct, 2002

Stringtokenizer Posted: Jan 23, 2003 9:49 AM
Reply to this message Reply
Advertisement
Hello everyone
I have a stringtokenizer with this inside of it
[firstname,lastname]
[addr1,addr2]
how can i get the first line [firstname,lastname] and use it in my code some where else and once i have use it get the next line [addr1,addr2] and do the same with this line?
thanks


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Stringtokenizer Posted: Jan 25, 2003 7:03 PM
Reply to this message Reply
It appears that you are describing a data set with two lines per set.

You can use a BufferedReader object to read one line in at a time or use the BufferedReader readLine method once to just get the first line, or twice to get the second line.

String dataSet = "[firstname,lastname]\n" + "[addr1,addr2]";
StringReader sr = new StringReader(dataSet);
BufferedReader br = new BufferedReader(sr);
String firstLine = br.readLine();
String secondLine = br.readLine();

I am not sure if this answers your question. If not post again.

Flat View: This topic has 1 reply on 1 page
Topic: Logfiles Previous Topic   Next Topic Topic: Maximizing Internal Frames

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use