String position
From Coderwiki
More actions
Most programming languages implement a position or indexOf method on strings.
This method will return the index of the first character of the substring in the main string.
Example
edit edit source
The following Java code shows the indexOf method:
String haystack = "Hello world, Java is a programming language";
String needle = "Java";
int position = haystack.indexOf(needle);
System.out.println(position); // 13