一:类的定义
public final class String extends Object implements Serializable, Comparable<String>, CharSequence
01.final定义,不能被继承,是Object类的子类,
02.实现了可序列化接口(Serializable),比较器接口(Comparable<String>),字符接口(CharSequence);
二:常用方法:
01.字母变小写: public String toLowerCase();
02.字母变大写: public String toUpperCase();
03.获取字符串长度: public int length();
04.字符串是否为空: public boolean isEmpty();
05.字符串比较: public boolean equals(Object anObject);
06.忽略大小写比较: public boolean equalsIgnoreCase(String anotherString);
07.转变为char类型数组:public char[] toCharArray();
08.根据正则表达式拆分:public String[] split(String regex);
09.查询指定字符的位置:public int indexOf(String str);
10.截取指定长度字符串:public String substring(int beginIndex, int endIndex);
11.替换字符串: public String replace(char oldChar, char newChar);
12.连接字符串: public String concat(String str);
13.判断字符串是否存在:public boolean contains(CharSequence s);