L
L
Li_Von2017-06-06 18:28:05
Java
Li_Von, 2017-06-06 18:28:05

How can a String type be converted to int?

Hello everyone, let's assume that a String type variable contains a string - "20". How can this value be overwritten into an int variable ? Is there any generic algorithm or keyword?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
goodTimes, 2017-06-06
@Li_Von

Integer x = Integer.valueOf(str);
or
int y = Integer.parseInt(str);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question