function to find if a substring is a prefix of a string code example
Example 1: java string contains at beginning
public class StringExample
{
public static void main(String[] args)
{
String blogName = "howtodoinjava.com";
blogName.startsWith(null);
}
}
Example 2: java string contains at beginning
public class StringExample
{
public static void main(String[] args)
{
String blogName = "howtodoinjava.com";
System.out.println( blogName.startsWith("how") );
System.out.println( "howtodoinjava.com".startsWith("howto") );
System.out.println( "howtodoinjava.com".startsWith("hello") );
}
}