String manipulation programm ( string to float or string to integer conversion) can anyone pls help me with this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

String manipulation programm ( string to float or string to integer conversion) can anyone pls help me with this

31st Mar 2021, 4:32 AM
Yuvrajsinh Chudasama
Yuvrajsinh Chudasama - avatar
2 Answers
+ 4
Mahmoud 'Carbon' Saghraoui Same as integer we can also parse string in float like that. float val = Float.parseFloat(test):
31st Mar 2021, 5:29 AM
A͢J
A͢J - avatar
+ 1
I'm not a Java Expert but i've found some interesting articles about your problem, string manipulation can be a bit complicated but still manageable. To convert from string to float you can read the article below: https://www.educba.com/java-string-to-float/. But if you want to convert from string to integer then here: Use 'Integer.parseInt' String test = "200"; int i=Integer.parseInt(test); This will convert test to an integer, which is 200.
31st Mar 2021, 4:46 AM
Carbon
Carbon - avatar