public class lianxi1 {
public static void main(String[] args) {
String a ="张三是个小学生";
String b ="李四不是人";
System.out.println(a.charAt(2));//返回指定下标索引位置的数据
//是
System.out.println(a.codePointAt(2));//返回指定下标索引处的字符Unicode代码点
//26159
System.out.println(a.codePointBefore(3));//返回指定下标索引出字符unicode代码点的前一位
//26159
System.out.println(a.codePointCount(1,6));//返回指定范围内unicode代码点数
//5
System.out.println(a.compareTo(b));//按字典顺序比较两个字符串
//-2094
System.out.println(a.concat(b));//将指定字符串连接到此字符串的结尾
//张三十个小学生李四不是人
System.out.println(a.contentEquals(b));//判断此字符串与自定的StringBuffer比较
//false
char[] aa = {'a','b','c'};
System.out.println(a.copyValueOf(aa));
System.out.println(a.endsWith("生"));//判断该字符串是否已指定字符结束
System.out.println(a.indexOf("是"));//返回该字符的下标 第一个
System.out.println(a.charAt(a.indexOf("学生")));//返回指定索引位置的char值
System.out.println(a.substring(a.indexOf("小"), 7));//返回指定下标,和从下标开始,指定长度的值
System.out.println(a.lastIndexOf("生"));
System.out.println(a.offsetByCodePoints(2, 2));//返回一个地址所引处在向后2个单位的索引号
//4
System.out.println(a.isEmpty());
}
}