标签:
package com.text_1;
public class lianxi1111 {
public static void main(String[] args) {
// TODO 自动生成的方法存根
//代码实现判断字符串的开头和结尾
String str="jnjcubhksbwiowhfkalohafwac";
if (str.indexOf("jnj")==0)
{
System.out.println("jnj"+"是字符串的开头");
}
//System.out.println(str.length());
System.out.println(str.substring(str.length()-3));
if(str.substring(str.length()-3)=="wac")
{
System.out.println("字符串的结尾是"+"wac");
}
else
{
System.out.println("cuowu");
}
}
}

标签:
原文地址:http://www.cnblogs.com/jakeasd/p/5491635.html