Java Finding A Character In A String

[Solved] Java Finding A Character In A String | Scala - Code Explorer | yomemimo.com
Question : java Finding a Character in a String

Answered by : adi

String txt = "Please locate where 'locate' occurs!";
System.out.println(txt.indexOf("locate")); // Outputs 7

Source : | Last Update : Fri, 22 Oct 21

Question : find char in string java

Answered by : vivacious-vulture-woz6203hqko9

String str = "testdemo"; System.out.println("String: "+str); int index = str.indexOf( 'h' ); System.out.printf("'h' is at index %d\n", index);

Source : | Last Update : Sun, 22 Aug 21

Answers related to java finding a character in a string

Code Explorer Popular Question For Scala