• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Importing values from html

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
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:
[code]
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
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Robert Ploch
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx, the tokenizer helped me out
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic