数字与字符串

1.数字转字符串

 int i = 5;
         
        //方法1
        String str = String.valueOf(i);
         
        //方法2
        Integer it = i;
        String str2 = it.toString();

2.字符串转数字

        String str = "999";
         
        int i= Integer.parseInt(str);
         
        System.out.println(i);

3.StringBuffer

 

转载于:https://www.cnblogs.com/StingLon/p/11400846.html

你可能感兴趣的:(数字与字符串)