202002062025——《String相关》

 //1. String常用构造方法
String(byte[] byte, int offset, int length);
String(char[] char, int offset, int count);
String(char[] value);

//2. 常用方法
char charAt(int index);
String substring(int beginIndex, int endIndex);
boolean startsWith(String prefix);
boolean startsWith(String prefix, int toOffset);

//3. 查找
int indexOf(String ch);//指定字符在此字符串第一次出现的索引
int indexOf(String ch, int startIndex);

//4. repalce
String replace(oldChar, newChar);
String replaceAll(Rex, replacement);
String replaceFirst(Rex, replacement);

//5.
boolean isEmpty();
//当length();为0时 -> true

 

posted @ 2020-02-06 20:48  Coca-code  阅读(65)  评论(0编辑  收藏  举报