JAVA字符串的基本操做

鏈接字符串:+orm

獲取長度:length;字符串

查找:str.indexOf(object value);/lastIndexOf(object value);string

替換:replace(char oldChar, char newChar);it

獲取指定位置的字符:charAt(int index);ast

獲取子字符串:substring(int fromIndex); /substring(int fromIndex, int toIndex);form

去除空格:trim();object

判斷字符串的開始和結尾:startsWith(Stringprefix);/endWith(String suffix);im

判斷是否相等:equals();       equalsIgnoreCase();co

按字典順序比較兩個字符串:compareTo(String otherStr);字典

字母大小寫切換:toLowerCase();  toUpperCase();

字符串分割:split(Stringsign); split(String sign, int limit);

格式化:format(String format, Object args);

相關文章
相關標籤/搜索