String的indexOf()的三种情况

public class StringIndexOfTest {

	public static void main(String[] args) {
		String a = "10";
		String b = "A10";
		String c = "10A";
		int index = a.indexOf("A");  //-1
		int index2 = b.indexOf("A");  //0
		int index3 = c.indexOf("A"); //2
	}
}

  

posted @ 2021-02-04 10:08  信铁寒胜  阅读(187)  评论(0编辑  收藏  举报