目录
2. public boolean endsWith(String suffix)
1. startsWith() 方法
startsWith() 方法用于检测字符串是否以指定的前缀开始。
方法名 | 说明 |
---|---|
public boolean startsWith(String prefix) | 测试此字符串是否以指定的前缀开始。 |
public boolean startsWith(String prefix, int toffset) | 测试此字符串从指定索引开始的子字符串是否以指定前缀开始。 |
参数
prefix -- 前缀。
toffset -- 字符串中开始查找的位置。
返回值
- 如果字符串以指定的前缀开始,则返回 true;否则返回 false。
2. public boolean endsWith(String suffix)
endsWith() 方法用于测试字符串是否以指定的后缀结束。
参数