nl_tokens: Returns the longest string { @code suffix } such that { @code a . toString () . endsWith ( suffix ) && b . toString () . endsWith ( suffix ) } taking care not to split surrogate pairs . If { @code a } and { @code b } have no common suffix returns the empty string .
pl_tokens: public static String commonSuffix ( CharSequence a , CharSequence b ) { checkNotNull ( a ) ; checkNotNull ( b ) ; int maxSuffixLength = Math . <mask> ( a . length ( ) , b . length ( ) ) ; int s = 0 ; while ( s < maxSuffixLength && a . charAt ( a . length ( ) - s - 1 ) == b . charAt ( b . length ( ) - s - 1 ) ) { s ++ ; } if ( validSurrogatePairAt ( a , a . length ( ) - s - 1 ) || validSurrogatePairAt ( b , b . length ( ) - s - 1 ) ) { s -- ; } return a . subSequence ( a . length ( ) - s , a . length ( ) ) . toString ( ) ; }