Double convert | SoloLearn: Learn to code for FREE!

0

Double convert

how to get value after , 45,7 get number 7 or 45,8 get number 8

5/17/2018 6:51:15 AM

Rian Pratama

6 Answers

New Answer

+6

s.substring(s.indexOf(',') + 1) where s is a string containing 45,7 or 45,8 etc.

+5

Rian Pratama Just replace ( , ) with ( . ) in the code snippet above. s.substring(s.indexOf('.') + 1) To convert from String to double, you can use Double.valueOf(s) For vice versa (double to String) String.valueOf(d) where d is a variable of type double. If you want to remove the dot ( . ), replace it. s = s.replace(".", "");

+2

work, thanks you very much

0

sorry, how to remove . I covert to double

0

0

thanks you very much Master.