This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Importing values from html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Importing values from html" Watch "Importing values from html" New topic

Importing values from html

Robert Ploch

Joined: Jun 05, 2002
Posts: 19
I want to import the following values into my applet:

since they are treated as strings by default, they must be converted into double and copied into an array.
the problem is:
double[] RohDaten = new double[ Werte ];
for ( int i = 0; i < RohDaten.length; i++ )
String temp = getParameter( "data" );
RohDaten[ i ] = Double.valueOf( temp ).doubleValue();
initializes the whole value for every i.
thats why Double.valueOf(String) doesnt work. is there another short method to do this?
thx for helping
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
You should only call getParameter("data") once (outside any loop) since it grabs the entire string at once. Then you need to split the string into parts, and parse each part separately. I recommend looking at the StringTokenizer class. Or check out String's split() method in SDK 1.4.

"I'm not back." - Bill Harding, Twister
Robert Ploch

Joined: Jun 05, 2002
Posts: 19
thx, the tokenizer helped me out
Consider Paul's rocket mass heater.
subject: Importing values from html
Similar Threads
How to sum array input.
StackOverflowError when trying to use threads
BigDecimal Contsructer Pitfall.
looping into an array help
confusion in double operations...