java find first occurrence in string

Solutions on MaxInterview for java find first occurrence in string by the best coders in the world

showing results for - "java find first occurrence in string"
Marco
12 Sep 2020
1// Use indexOf()
2String myStr = "Hello planet earth, you are a great planet.";
3System.out.println(myStr.indexOf("planet"));