当前位置: 技术问答>java相关
如何判断某一个String变量中是否存放制表键(tab)的值,最好有例子。
来源: 互联网 发布时间:2015-02-15
本文导语: | 就这么简单: public class StringTabTest { public static void main(String[] args) { String astring = "abcdtefgh"; System.out.println(astring); System.out.println(astring.indexOf("t") > 0);//print true astring = "abcdefgh"...
|
就这么简单:
public class StringTabTest {
public static void main(String[] args) {
String astring = "abcdtefgh";
System.out.println(astring);
System.out.println(astring.indexOf("t") > 0);//print true
astring = "abcdefgh";
System.out.println(astring);
System.out.println(astring.indexOf("t") > 0);//print false
}
}
public class StringTabTest {
public static void main(String[] args) {
String astring = "abcdtefgh";
System.out.println(astring);
System.out.println(astring.indexOf("t") > 0);//print true
astring = "abcdefgh";
System.out.println(astring);
System.out.println(astring.indexOf("t") > 0);//print false
}
}