The String class has the following methods:
StartsWith (String prefix)
Boolean java.lang.String.startsWith (String prefix)
Tests If this string starts with the specified prefix.
-
-
Parameters:
-
-
prefix the prefix.
-
-
Returns:
-
-
true
If the character sequence represented by the argument are a prefix of the character sequence by this String
false
otherwise. Note also that would be
true
returned if the argument is a empty string or is equal to this
String
object as determine D by the
equals(Object)
method.
-
-
Since:
-
-
1.0
-
-
-
is to determine if the suffix in the string is a parameter prefix, and if it is true, return FALSE if it is not.
-
-
This can be used to identify audio files, such as MP3 files, in Android.
-
-
corresponding, there is a method,
-
-
endsWith (String suffix)
-
-
boolean java.lang.String.endsWith (String suffix)
Tests If this string ends with the specified suffix.
-
Parameters:
-
suffix the suffix.
-
Returns:
-
true
If the character sequence represented by the argument are a suffix of the character sequence by this Object
false
otherwise. Note that the result would be
true
if the argument are the empty string or is equal to this
String
object as deter Mined by the
equals(Object)
method.
can be used to determine whether a string begins with the suffix parameter.
-
Some methods of the String class