0

Double convert

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

17th May 2018, 6:51 AM
Rian Pratama
Rian Pratama - avatar
6 Respostas
+ 6
s.substring(s.indexOf(',') + 1) where s is a string containing 45,7 or 45,8 etc.
17th May 2018, 6:56 AM
Dev
Dev - avatar
+ 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(".", "");
17th May 2018, 7:35 AM
Dev
Dev - avatar
+ 2
work, thanks you very much
17th May 2018, 7:21 AM
Rian Pratama
Rian Pratama - avatar
0
sorry, how to remove . I covert to double
17th May 2018, 7:31 AM
Rian Pratama
Rian Pratama - avatar
0
( . )
17th May 2018, 7:32 AM
Rian Pratama
Rian Pratama - avatar
0
thanks you very much Master.
17th May 2018, 7:46 AM
Rian Pratama
Rian Pratama - avatar