The Artima Developer Community
Sponsored Link

Java Answers Forum
how can i read individual String from a String

3 replies on 1 page. Most recent reply: Mar 27, 2003 3:14 AM by Roger

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 3 replies on 1 page
Roger

Posts: 6
Nickname: lionheart
Registered: Mar, 2003

how can i read individual String from a String Posted: Mar 25, 2003 7:42 PM
Reply to this message Reply
Advertisement
assuming i have a String

String aString = "stringA\n" + "Stringb\n" + "Stringc\n";

how can i break the String up so that i can store

String a, b, c;
a = stringA;
b = stringb;
c = stringc;


Alex S

Posts: 27
Nickname: andu
Registered: Mar, 2003

Re: how can i read individual String from a String Posted: Mar 26, 2003 1:26 AM
Reply to this message Reply
Use <code>StringTokenizer</code> class to parse your string. And tell to constructor that "\n" is the delimiter.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: how can i read individual String from a String Posted: Mar 26, 2003 10:06 AM
Reply to this message Reply
There's an example that does this using Jython a few posts down:
http://www.artima.com/forums/flat.jsp?forum=1&thread=4099

Roger

Posts: 6
Nickname: lionheart
Registered: Mar, 2003

Re: how can i read individual String from a String Posted: Mar 27, 2003 3:14 AM
Reply to this message Reply
thanks for the help!

Flat View: This topic has 3 replies on 1 page
Topic: Is it possible to draw shapes on an image in applet? Previous Topic   Next Topic Topic: Applet Servlet Communication

Sponsored Links



Google
  Web Artima.com   

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