Java String starts with
public class Main { public static void main(String[] args) { String s = "demo2s.com"; //from w w w . j ava 2 s . c o m boolean b = s.startsWith("demo"); System.out.println(b); } }