一、字符串相关的类:String常用的方法:
int length():返回字符串的长度:return value.length
char charAt(int index):返回某索引处的字符:return value[index]
boolean isEmpty():判断是否为空字符串:return value.length == 0
String toLowerCase():使用默认语言,将String中的所有字符转换为小写
String toUpperCase():使用默认语言,将String中的所有字符转换为大写
String trim():返回字符串的副本,忽略前导空白和尾部空白
boolean equals(Object obj):比较字符串的内容是否相同
boolean equalsIgnoreCase(String anotherString):与equals方法相似,忽略大小写
String concat(String str):将指定字符串连接到此字符串的结尾。等价于用"+"
int compareTo(String anotherString):比较两个字符串的大小
String substring(int beginIndex):返回一个新的字符串,它是此字符串的从beginIndex开始截取到最后的一个子字符串
String substring(int beginIndex,int endIndex):返回一个新的字符串,它是此字符串的从beginIndex开始截取到endIndex(不包含)的一个子字符串
boolean endsWith(String suffix):测试此字符串是否以指定的后缀结束
boolean startsWith(String prefix):测试此字符串是否以指定的前缀开始
boolean startsWith(String prefix,int toffset):测试此字符串从指定索引开始的子字符串是否以指定前缀开始
boolean contains(CharSequence s):当且仅当此字符串包含指定的char值序列时,返回true
int indexOf(String str):返回指定子字符串在此字符串中第一次出现处的索引
int indexOf(String str,int fromIndex):返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始
int lastIndexOf(String str):返回指定子字符串在此字符串中最右边出现处的索引
int lastIndexOf(String str,int fromIndex):返回指定子字符串在此字符串中最后一次出现的索引,从指定的索引开始反向搜索
注:indexOf和lastIndexOf方法如果未找到都是返回-1。
String replace(char oldChar,char newChar):返回一个新的字符串,它是通过用newChar替换此字符串中出现的所有oldChar得到的
String replace(CharSequence targe......
原文转载:http://www.shaoqun.com/a/897410.html
跨境电商:https://www.ikjzd.com/
巴克莱银行:https://www.ikjzd.com/w/2775
万色:https://www.ikjzd.com/w/2382
邮乐网:https://www.ikjzd.com/w/1776
一、字符串相关的类:String常用的方法:intlength():返回字符串的长度:returnvalue.lengthcharcharAt(intindex):返回某索引处的字符:returnvalue[index]booleanisEmpty():判断是否为空字符串:returnvalue.length==0StringtoLowerCase():使用默认语言,将String中的所有字符转换
etsy:https://www.ikjzd.com/w/169.html
贝贝母婴网:https://www.ikjzd.com/w/1321
香港有哪些品牌的手表?:http://www.30bags.com/a/404012.html
香港有哪些适合带回家的零食?香港有哪些必吃零食?:http://www.30bags.com/a/404498.html
香港有哪些适合学生逛街的地方?:http://www.30bags.com/a/404865.html
香港有哪些特色街道?:http://www.30bags.com/a/404766.html
男朋友吻我下面过程 男生㖭女人下部技巧:http://www.30bags.com/m/a/249761.html
荒岛上和野狗生活的萝莉 凌淑娟在仓库被一群野狗:http://www.30bags.com/m/a/249679.html
张爱玲及其性描写:http://lady.shaoqun.com/a/434482.html
五个现象说明女人想和你上床:http://lady.shaoqun.com/a/434483.html
有多少男生觉得女人一被感动就兴奋?:http://lady.shaoqun.com/a/434484.html
女人给你这四个暗示是因为想和你发生关系!:http://lady.shaoqun.com/a/435471.html
没有评论:
发表评论