java - Partially Equal strings and the index of the shared charachter -
if want evaluate 2 strings partially equal, can use contains "hello".contains"heu"
but question how indexes of characters equal?
you use pattern , matcher classes.
string s1 = "hello"; string s2 = "he"; matcher m = pattern.compile("(?i)" + s2).matcher(s1); while (m.find()) { system.out.println(m.start()); }
output:
0
Comments
Post a Comment