数字字符串转整数public static int stringToInt(String str){ int sum = 0; char[] temp = str.toCharArray(); int count = 0; while(count<str.length() && temp[count]!=' '){ sum=sum*10+(temp[count]-'0'); count++; } return sum; }版权声明:本文为dingherry原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/dingherry/article/details/6238493