New course! Every coder should learn Generative AI!
Try a free lesson0
How to change the string into an integer ...
5 Answers
+ 7
Specify a relevant language name in the tags ☝
This is something done in variius ways differed by language.
+ 5
∆BH∆Y I think you meant
a = "12345"
a = int(a)
The OP asked for string to int, not int to string.
In Java, what seems to be the only language course you're taking, you can do something like;
String n = "12345";
int num = Integer.parseInt(n);
// Or
Integer num = Integer.valueOf(n)
parseInt() will return an value with type int, where valueOf() will return an Integer object.
+ 2
As Ipang said, specify the language
As in Python, you can do this:
a = "12345"
a = int(a)
+ 1
ChaoticDawg Oh, I'm sorry
I misread the question
I made the changes
0
It's correct