String has Prefix via startsWith() method - Android java.lang

Android examples for java.lang:String Starts or Ends

Description

String has Prefix via startsWith() method

Demo Code

import java.util.List;
import java.util.Map;

public class Main{

    public static boolean hasPrefix(String str, String prefix) {
        return str != null && prefix != null && str.startsWith(prefix);
    }/* w w  w . j  a v  a2  s. c o m*/

}

Related Tutorials