Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting an array of string to double value.....

 
Philip Zac
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Is there any way that I can convert a string say ("11, 22, 33") to an array of double values ???

Thanks

Philip
 
Sid Murrey
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use StringTokenizer with a matching delimiter pattern to split the string according to the commas. Then iterate over the resulting array and use the Double.valueOf() method to convert the Strings to doubles.
[ July 10, 2008: Message edited by: Cedric Meury ]
 
Philip Zac
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot Cedric Meury ......


Philip
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic