第五章字符串学习

2018-11-14  本文已影响0人  黄敬理

字符串学习
1.定义
概念:
注意
2.常用方法
str.charAt(index); 获取指定位置的字符


image.png

a.indexOf(substr); 获取字符串索引位置


image.png
str.startsWith(prefix);判断字符串是否以指定前缀开始
image.png
str.endsWith(suffix);判断字符串是否以指定后缀结束
image.png
str.toCharArray();获取字符串数组
image.png
str.contains(string) 判断字符串是否存在
image.png

str.substring(beginIndex);
str.substrinig(beginIndex,endIndex); 截取字符串


image.png image.png image.png image.png image.png image.png
上一篇 下一篇

猜你喜欢

热点阅读