黑马程序员技术交流社区

标题: String常用的方法 [打印本页]

作者: 18248119733    时间: 2016-7-29 22:44
标题: String常用的方法
常用方法!!!!!!(都是最常用的方法要求大家今晚练习!)
                * public String toUpperCase():小写转大写
                * public String toLowerCase():大写转小写
                * public int length():获取长度   -->数组中  length;!!
                * public boolean contains(CharSequence s):判断调用方法字符串是否包含参数字符串!!!
                * public String substring(int start):截取从start索引开始到最后的子字符串    !!!!
                * public String substring(int start,int end):截取指定位置的子字符串         !!!!
                * public String trim():去除字符串两端空白                                  !!!
                * char[] toCharArray():把字符串转换为字符数组。                            !!!
                * char charAt(int index):获取指定索引位置的字符。                          !!!!
                * int indexOf(int ch):返回指定字符在此字符串中第一次出现处的索引。         !!!
                * int indexOf(String str):返回指定字符串在此字符串中第一次出现处的索引。   !!!!
  
作者: wyq0627java11    时间: 2016-7-29 22:59
我喜欢,实用
作者: 一条寂寞的鱼    时间: 2016-7-29 23:02
呦  14期的小伙伴
作者: HeiMa2Wangkunpe    时间: 2016-7-29 23:10
我们刚学的 Stirng类  谢谢 分享




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