indexof java

Java
The java string indexOf() method returns index of given character value or substring. If it is not found, it returns -1. The index counter starts from zero.public class MyClass {
  public static void main(String[] args) {
    String myStr = "Hello planet earth, you are a great planet.";
    System.out.println(myStr.indexOf("planet"));
  }
}

Source

Also in Java: