`

indexOf

 
阅读更多

今天碰到一个indexOf使用的问题,自己以前很清楚,今天因为事情比较多,突然给弄错了,幸亏还没发包,要不然一天几万单子有问题我可受不了啊,特此记录一下

package com.liuc.test;

public class indexOfTest {
	static String str="002912345566";
	public static void main(String[] args){
		String str="123";
		System.out.println("2".indexOf(str));
		System.out.println(str.indexOf("2"));
	}
}
 查看一个字符串A是否在指定的字符串B里面,应该写为B.indexOf(A)
分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

Global site tag (gtag.js) - Google Analytics