标签:lag ring this 开始 his 语句 public ati char
public class TestFast {
public static void main(String[]args){
String resp="";
int length=resp.length();
int flag=-1;
if(length>2){
int i=0;
// 从第1位的字符开始找,是不是{,如果不是,查看下一个,找到第n个,还不是,就报错
while(i<3){
if(resp.charAt(i)==123){
flag=0;
break;
}
else{
i++;
}
}
if(flag==0){
System.out.println("this is a json");
}else{
System.out.println("this is not a json");
}
//不是,就判断失败,给出结论
}else {
System.out.println("the response is not a json,the length is 0 or 1,or 2(not {})");
}
}
}
标签:lag ring this 开始 his 语句 public ati char
原文地址:http://www.cnblogs.com/zhizhiyin/p/7118245.html