static public int match ( String s1 , String s2 ) { int i = 0 ; while ( ( i < s1 . length ( ) ) && ( i < s2 . length ( ) ) ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) { break ; } i ++ ; } return i ; }
Count number of chars that match in two strings starting from front .