public static String [ ] trimStringArray ( final String [ ] input ) { final ArrayList < String > output = new ArrayList < String > ( ) ; for ( int i = 0 ; i < input . length ; i ++ ) { String s = input [ i ] . trim ( ) ; if ( ! s . equals ( "" ) ) output . add ( s ) ; } return output . toArray ( new String [ 0 ] ) ; }
Trims an array of Strings to remove the whitespace . If the string is empty then its removed from the array .