Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Strings to a series of Doubles  RSS feed

 
Simon Cross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May seem like a stupid question but is it possible to convert strings from a readLine() call into a series of doubles. And if so (got to be able to) how?
thanx
 
Matt Siegel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Double class has a static method:
double parseDouble(String s)
You will want to use a StringTokenizer, and use parseDouble on each of the String's returned from the tokenizer. And then do what you want with each one.

HTH,
Matt
 
Simon Cross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!