String integer conversion

zhaozj2021-02-11  193

1 How to convert a string string into an integer int?

A. There are two ways:

1). INT i = integer.parseint ([string]); or i = integer.parseint ([String], [INT RADIX]);

2). INT i = integer.valueof (my_str) .intValue ();

Note: The string is transformed into Double, Float, and long.

2 How to convert integer int converted into a string string?

A. Have a variety of methods:

String s = String.Valueof (i);

2.) String s = integer.tostring (i);

3.) String s = "" i;

Note: Double, Float, long-converted to string is similar.

转载请注明原文地址:https://www.9cbs.com/read-4346.html

New Post(0)