str=str.substring(int beginIndex); 截取掉str從首字母起長度為beginIndex的字符串,將剩余字符串賦值給str;
str=str.substring(int beginIndex,int endIndex); 截取str中從beginIndex開始至endIndex結束時的字符串,并將其賦值給str;
例:截取字符串并轉成數字。 String temp = sid.substring(1);//截取掉sid第一位 int i =Integer.parseInt(temp);//轉為int i++; //還原為String temp = String.valueOf(i);
新聞熱點
疑難解答