1. String------>int
1.1 "123"-----> 1, 2, 3
Method 1:
string s =new string (); s= "123"; int i=integer.parseint (s.substring (0,2))// int i=123int i=integer.parseint ( S.substring (0,1))// int i=12int i=integer.parseint (s.substring)// int i=23int i=integer.parseint ( S.substring (0,0))// int I=1
int I=integer.parseint (s.substring (0,0))// int I=1
Method 2:
String is converted to char[] and converted to int, which is no longer detailed
1.2 "123"------> 123,
string s =new string (), s= "123", int i=integer.parseint (s.substring (0,2))//int i=123 in the case of no more than int value range
2,string--------->char[]
string s =new string (); s= "123"; Char [] d;d=S.tochararray (); System.out.println (d[1]);
3,char------->int
String s =new= "12345" ; int i; // i= integer.valueof (s,3); Char [] d;d=S.tochararray (); System.out.println ((int) (d[4]-48));
4,int---------->char
int A=1
Char b= (char) (a+48)
5,int-------->string
int A=1
Char b= (char) (a+48)
Stringc= b+b+b;
Dierzhon
1 "string.valueof (i)
2 "integer.tostring (i)
3 "i+" "
6,int---->char[]
int a = 12345;
Java Learning-3 string char char[] int cross-transfer