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