字符串的比较:
equals(si:string):boolean 如果这个字符串等于字符串s1,则返回ture;
equalsIgnoreCase(s1:String):boolean 如果不区分大小写这个字符串等于s1,则返回true;
compareTo(s1:String):int 返回大于0,等于0,小于0,的整数,表明这个字符>=<s1;
CompareToIgnoreCase(si:String) 不区分大小写, 返回大于0,等于0,小于0,的整数,表明这个字符>=<s1;
regionMatches(index:int. s1:String, s1Index:int .len:int):boolean 如果这个字符串指定的子域精确匹配到字符串s1中指定的子域则返回true;
regionMatcher(ignorecase:boolean index:int. s1:String, s1Index:int .len:int):boolean
ignorecase:boolean ==true 不区分大小写
==flash 区分大小写
如果这个字符串指定的子域精确匹配到字符串s1中指定的子域则返回true;
startsWith(prefix:String):boolean 指定前缀开始返回true;
endsWith(suffix:String):boolean 指定后缀结束则返回true;
字符串长度,字符及组合字符串
String.length( ):int 返回这个字符串的字符个数。
String.charAt(index:int):char 返回这个字符串的指定下标处的字符
String.concat(s1:String):String 返回连接这个字符串和字符串s1所构成的新字符串获取子串
获取子串
subString(beginIndex:int):String 返回这个子字符中beginIndex开始延续到尾子串
subString(beginIndex:int , endIndex:int )String 获取beginIndex到endIndex处的子串
字符串的转换。替换和分割
toLowerCase( ):String 转换成小写
toUpperCase( ):String 转换成大写
Trim( ):String 去掉俩段空白部分
Replace(oldChar:char ,newChar:char):String 用新字符代替旧字符
ReplaceFirst(oldstring:string,newString:string):string 第一个新字符串代旧子串
replaceAll(oldstring:string,newString:string):string 全部匹配子串用新字符串代替
Split(delimiter:string):string【】 返回用界定符分割的子串所构成的字符数组
找字符串的某个子串或字符
indexOf(ch:char):int 返回字符串中第一次出现ch的小标 没有匹配则返回-1;
indexOf(ch:char,fromIndex:int):int 返回formIndex之后第一次出现ch的下标
indexOf(s:string):int 返回字符串匹配的第一次出现的下标,不匹配则返回-1
indexOf(s:string,formIndex:int):int 返回formindex之后第一次出现的下标
lastIndexOf(ch:char):int 返回字符串中最后一次出现ch的小标 没有匹配则返回-1;
lastIndexOf(ch:char,fromIndex:int):int 返回formIndex之后最后一次出现ch的下标
lastIndexOf(s:string):int 返回字符串匹配的最后次出现的下标,不匹配则返回-1
lastIndexOf(s:string,formIndex:int):int 返回formindex之后最后次出现的下标
字符串与数组之间的转换
toCharArray( ):char[] 字符串转换为字符数组
getChars(int srcbegin,int srcEnd,char[]dst,int detBegin) 将下标从srcbegin到srcend-1的子串复制到数组dst中下标从detbegin的位置、
String(char[])//valueOf(char[]):将一个字符数组转换成一个字符串
将字符和数值转换成字符
valueOf(c:char):string 返回包含字符C的字符串
valueOf(data:char【】):string 返回包含数组中字符的字符串
valueOf(d:double/ f:float/ i:int/ l:long/ b:boolean):string 返回表示各种值的字符串表达式
字符串转换double型值或int值
Double.parseDouble(str)
Integer.parseInt(str)
格式化字符串
String.format(format, item1,item2,item3......itemk);返回一个格式化字符串