/** * @author lautturi.com * Java example: Java String startsWith / determine whether a string start with another string in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { String str = "welcome to lauttur! java world!"; System.out.println(str.startsWith("welcome")); System.out.println(str.startsWith(" welcome")); } }
output:
true false