How do I change String to Int?

Asked 2 years ago, Updated 2 years ago, 141 views

I use Java. How do you change String to int type in Java? The string has numbers like "1234" and I want to change it to 1234

string java type-conversion

2022-09-21 16:04

1 Answers

    int foo = Integer.parseInt("1234");

You can change it like this. If you use StringBuffer, you can change it to Integer.parseInt(myBuffer.toString()); like this.

I think it'll be more helpful if you watch this. java document


2022-09-21 16:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.