判断以xx开头的字符串
public static void main(String[] args) { String str = "EAN_13,1534651"; String strHttp = "http://weixing.qq.com"; System.out.println(str.startsWith("EAN")); System.out.println(strHttp.startsWith("http")); }
结果:
public static void main(String[] args) { String str = "EAN_13,1534651"; String strHttp = "htp://weixing.qq.com"; System.out.println(str.startsWith("EAN")); System.out.println(strHttp.startsWith("http")); }