Java: String to Int - how to
In Java you can convert a String as a Integer.
- In the case of an Integer, the Computer stores an integer value. In the case of a String, in turn, a string is stored, so only the single digits.
- We have defined with the command "String string_1 = "1234";" a String that contains only Numbers. This in an Integer transform, the command "int value_1 = Integer.parseInt(string_1);" used up to this point no Problem.
- It is difficult, however, if the String contains spaces. The String that we have defined with the command "String string_2 = "087 105 114 032 098 101 105 032 067 072 073 080 032 098 101 104 101 114 114 115 099 104 101 110 032 100 101 110 032 071 114 097 109 109 097 116 105 107 046";" we can't convert to an Integer. Here is a little more effort would be needed.
- Further practical tips can be found in our Java-programming-Guide.

Java: String to Int - is it possible?
In the next practical tip we show you how to array in Java is very easy to create can.
