This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi, there, Can anybody tell me how to do this?? Thanks in advance. //The jsp code /* ... String s[] { "param1", "value1", "param2", "value2", } ... StringBuffer sb = new StringBuffer(); DataOutputStream printout = new DataOutputStream(urlConn.getOutputStream()); .... sb = new StringBuffer(); BufferedReader in = new BufferedReader(new inputStreamReader(urlConn.getInputStream())); ... out.println(sb); */ the results are "1478,1528,1530,1531," s[0] = param1; s[1] = value1. the server return the string results to me based on parameters I sent. How can I make a new array to become this? s2[1478]; s2[1528]...
Phil Hanna
Ranch Hand
Joined: Apr 05, 2001
Posts: 118
posted
0
Not sure I fully understand your question, but if you want to load the contents of a comma-separated string into an array, you can use StringTokenizer:
------------------ Phil Hanna Sun Certified Programmer for the Java 2 Platform Author of : JSP: The Complete Reference Instant Java Servlets
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
Zoe Peng
Ranch Hand
Joined: Nov 27, 2000
Posts: 112
posted
0
Thanks. I got it. It works. I went through array concepts and string again.. finally..Bingo! --Zoe