str2.startsWith(prefix: String): boolean
class startwith
{
public static void main(String[] arg)
{
String str1 = "Welcome to Smartprogrammeron.blogspot.in";
System.out.println("str1.startsWith(\"Wel\") is " + str1.startsWith("Wel"));
System.out.println("str1.startsWith(\"wel\") is " + str1.startsWith("wel"));
}
}
To check prefix. Is string starting with given string or not. It is case sensitive.
{
public static void main(String[] arg)
{
String str1 = "Welcome to Smartprogrammeron.blogspot.in";
System.out.println("str1.startsWith(\"Wel\") is " + str1.startsWith("Wel"));
System.out.println("str1.startsWith(\"wel\") is " + str1.startsWith("wel"));
}
}