我找到了一个解决方案,有代码(它可能对某人有用):
for (int i=0; i<httpGet.length(); i++) {
char c = httpGet.charAt(i);
if(c=='M' && Character.isDigit(httpGet.charAt(i+1)) &&
Character.isDigit(httpGet.charAt(i+2)) &&
httpGet.charAt(i+3)== '/' &&
Character.isDigit(httpGet.charAt(i+4))&&
Character.isDigit(httpGet.charAt(i+5))&&
httpGet.charAt(i+6)==' ' &&
Character.isLetter(httpGet.charAt(i+7))){
temp="-"+httpGet.substring(i+1,i+3);
dewP=httpGet.substring(i+4,i+6);
break;
}
else if(c=='M' && Character.isDigit(httpGet.charAt(i+1)) &&
Character.isDigit(httpGet.charAt(i+2)) &&
httpGet.charAt(i+3)== '/' &&
httpGet.charAt(i+4)== 'M' &&
Character.isDigit(httpGet.charAt(i+5))&&
Character.isDigit(httpGet.charAt(i+6))&&
httpGet.charAt(i+7)==' ' &&
Character.isLetter(httpGet.charAt(i+8))){
temp="-"+httpGet.substring(i+1,i+3);
dewP="-"+httpGet.substring(i+5,i+7);
break;
}
else if(Character.isDigit(httpGet.charAt(i)) &&
Character.isDigit(httpGet.charAt(i+1)) &&
httpGet.charAt(i+2)== '/' &&
httpGet.charAt(i+3)== 'M' &&
Character.isDigit(httpGet.charAt(i+4))&&
Character.isDigit(httpGet.charAt(i+5))&&
httpGet.charAt(i+6)==' ' &&
Character.isLetter(httpGet.charAt(i+7))){
temp=httpGet.substring(i,i+2);
dewP="-"+httpGet.substring(i+4,i+6);
break;
}
else if(Character.isDigit(c) && Character.isDigit(httpGet.charAt(i+1))
&& httpGet.charAt(i+2)=='/' &&
Character.isDigit(httpGet.charAt(i+3)) &&
Character.isDigit(httpGet.charAt(i+4)) &&
httpGet.charAt(i+5)==' ' &&
Character.isLetter(httpGet.charAt(i+6))){
temp=httpGet.substring(i,i+2);
dewP=httpGet.substring(i+3,i+5);
break;
}
}