Java 教程
startsWith() 方法用于檢測字符串是否以指定的前綴開始。
public boolean startsWith(String prefix, int toffset) 或 public boolean startsWith(String prefix)
prefix -- 前綴。
toffset -- 字符串中開始查找的位置。
如果字符串以指定的前綴開始,則返回 true;否則返回 false。
以上程序執(zhí)行結(jié)果為:
返回值 :true 返回值 :false 返回值 :true