黑马程序员技术交流社区

标题: String类的获取功能 [打印本页]

作者: Lblnc    时间: 2015-7-29 13:49
标题: String类的获取功能
ic int length():                                                        获取字符串的长度。
public char charAt(int index):                                获取指定索引位置的字符
public int indexOf(int ch):                                        返回指定字符在此字符串中第一次出现处的索引。
public int indexOf(String str):                                返回指定字符串在此字符串中第一次出现处的索引。
public int indexOf(int ch,int fromIndex):                返回指定字符在此字符串中从指定位置后第一次出现处的索引。
public int indexOf(String str,int fromIndex):                返回指定字符串在此字符串中从指定位置后第一次出现处的索引。
public String substring(int start):                                从指定位置开始截取字符串,默认到末尾。
public String substring(int start,int end):                从指定位置开始到指定位置结束截取字符串。





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2