package com.zzu.java.array;
public class TtString {
/**
* @author 程路超
* @param args
*/
public static void main(String[] args) {
String string = "abcdefghijklmnopqrstuvwxyz郑州制造郑州";
String s1 = " ab d ";
String s2 = "adb";
// string.charAt(index);//返回字符串中对应数组 "value[index]"下标的字符;
// char c= string.charAt(33);
// System.out.println(c);
// string.codePointAt(index);//返回char类型的字符对应的编码值
// int i=string.codePointAt(0);
// System.out.println(i);
// string.compareTo(anotherString);//比较两个字符串的大小 大于为正数 小于为负数 相等为0
// ,考虑大小写,而且小写字母比大写字母大
// System.out.println(s1.compareTo(s2));
// System.out.println(s1.compareToIgnoreCase(s2));
// string.concat(str);//连接字符串,但会创建一个新的字符串并返回 string+"新字符"
// String ss=string.concat("新字符");
// System.out.println(ss==string);
// System.out.println(string);
// System.out.println(ss);
// string.contains("abc");//查询是否包含指定的字符串,返回布尔值
// boolean ff=string.contains("abfc");
// System.out.println(ff);
// startWith以XXX开头 endsWith:以XXX结尾
// boolean ff=string.startsWith("acbc");
// boolean fs = string.endsWith("郑州");
// System.out.println(fs);
// equals:比较字符串的值,字符串重写了equals方法,将来我们的对象也可以重写equals
// System.out.println(s1==s2);
// System.out.println(s1.equals(s2));
// hashCode:获取对象的哈希值,如果两个对象equals那么他们的hashcode一定相同,但hashcode相同不一定equals
// System.out.println(s1.hashCode());
// System.out.println(s2.hashCode());
// getBytes获取字符串对应的字节数组,有可能产生乱码
// byte b[]=string.getBytes();
// for (int i = 0; i < b.length; i++) {
// System.out.println(b[i]);
// }
// indexOf:返回当前字符串所在的索引值
// int i=string.indexOf("cd");
// System.out.println(i);
//
// length:返回当前字符串的长度
// System.out.println(string.length());
// replace:替换
// String newstring = string.replace("abc", "oooooo");
// System.out.println(newstring);
// split:拆分字符串
// String ss[]=string.split("uvw");
// for (int i = 0; i < ss.length; i++) {
// System.out.println(ss[i]);
// }
// substring:截取字符串 [1,5)
// String news=string.substring(0,5);
// String newstr=string.substring(1,string.length());
// System.out.println(news);
// System.out.println(newstr);
// trim:去掉前后两端的空格
// System.out.println(s1.trim());
// toLowerCase toUpperCase 转换为大小写
// System.out.println(string.toLowerCase());//小写
// System.out.println(string.toUpperCase());
// valueOf 将 char 类型 的 字符 转换成 String 字符串
//String ss = String.valueOf('a');
str.toCharArray();//字符串转成字符数组
}
}