Tuesday 15 February 2011

I need to extract numbers from a String in Java -


In my program, the numbers need to be removed from the string given by the string.

  string numberoffhores = "12.0 8.0 7.0 7.0 7.0.0.0.0 2.0";   

I need to extract every value in an array. When I use the partitioning method from string class, I get a zero value and I do not get all the numbers in the array. Here's the code.

  string fragments [] = numberOfHours.split (""); For (int i = 0; i   

Thanks advance!

this:

  string numberoffhores = "12.0 8.0 7.0 7.0 10.0 8.0 0.0 2.0 "; String fragment [] = numberoff. Split ("\\ s +"); Println (pieces.length);   

Print: "8" Are you searching for it?

No comments:

Post a Comment