String 类有以下方法:
startsWith(String prefix)
Tests if this string starts with the specified prefix.
true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise. Note also that true will be returned if the argument is an empty string or is equal to this String object as determined by the equals(Object) method.Tests if this string ends with the specified suffix.
true if the character sequence represented by the argument is a
suffix of the character sequence represented by this object; false
otherwise. Note that the result will be true if the argument is the
empty string or is equal to this String object as determined by the
equals(Object)
method.原文:http://www.cnblogs.com/Sunnor/p/4817613.html