public static String normalize ( String val ) { if ( val == null || val . trim ( ) . length ( ) == 0 ) return null ; return val . trim ( ) ; }
Normalizes the given string by trimming it if non - null and returning null if null or empty .