public static String shrink ( String string ) { if ( string == null ) { return null ; } string = string . trim ( ) ; return SHRINK . matcher ( string ) . replaceAll ( " " ) ; }
Trims the string and replaces runs of whitespace with a single space .