We would like to know how to search Strings for Characters from String start.
public class MainClass{ //from w w w. jav a2 s . c om public static void main(String[] arg){ String str = "abcde"; int index = 0; index = str.indexOf('c'); System.out.println(index); }
The code above generates the following result.