文档介绍:String 方法摘要方法摘要 char charAt(int index) 返回指定索引处的 char 值。 int codePointAt(int index) 返回指定索引处的字符( Unicode 代码点)。 int codePointBefore(int index) 返回指定索引之前的字符( Unicode 代码点)。 int codePointCount(int beginIndex, int endIndex) 返回此 String 的指定文本范围中的 Unicode 代码点数。 pareTo(String anotherString) 按字典顺序比较两个字符串。 pareToIgnoreCase(String str) 不考虑大小写,按字典顺序比较两个字符串。 String concat(String str) 将指定字符串联到此字符串的结尾。 boolean contains(CharSequence s) 当且仅当此字符串包含 char 值的指定序列时,才返回 true 。 boolean contentEquals(CharSequence cs) 当且仅当此 String 表示与指定序列相同的 char 值时, 才返回 true 。 boolean contentEquals(StringBuffer sb) 当且仅当此 String 表示与指定的 StringBuffer 相同的字符序列时,才返回 true 。 static String copyValueOf(char[] data) 返回指定数组中表示该字符序列的字符串。 static String copyValueOf(char[] data, int offset, int count) 返回指定数组中表示该字符序列的字符串。 boolean endsWith(String suffix) 测试此字符串是否以指定的后缀结束。 boolean equals(Object anObject) 比较此字符串与指定的对象。 boolean equalsIgnoreCase(String anotherString) 将此 String 与另一个 String 进行比较,不考虑大小写。 static String format(Locale l, String format, Object... args) 使用指定的语言环境、格式字符串和参数返回一个格式化字符串。 static String format(String format, Object... args) 使用指定的格式字符串和参数返回一个格式化字符串。 byte[] getBytes() 使用平台默认的字符集将此 String 解码为字节序列,并将结果存储到一个新的字节数组中。 void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) 已过时。该方法无法将字符正确转换为字节。从 JDK 起, 完成该转换的首选方法是通过 getBytes() 构造方法, 该方法使用平台的默认字符集。 byte[] getBytes(String charsetName) 使用指定的字符集将此 String 解码为字节序列, 并将结果存储到一个新