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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -