How to find if a string starts with a particular word – JAVA ?
Hi,
In order to find whether a given string starts with a particular string or not in JAVA, use the following code.
public class Main {
public static void main(String[] args) {
String urStr = "Coderz Heaven";
if (urStr.startsWith("Coderz")) {
System.out.println("Yes! Your string starts with Coderz");
}
else {
System.out.println("No!");
}
}
}
Link to this post!