Android examples for java.lang:String Strip
Trim String, if String is null, return null
import java.io.UnsupportedEncodingException; import java.util.*; public class Main{ /**/*from w ww. j ava2 s .c o m*/ * Trim String, if String is null, return null * * @param str <code>String</code> * @return @see java.lang.String#trim */ public static String trim(String str) { String strReturn; if (str != null) { strReturn = str.trim(); } else { strReturn = str; } return strReturn; } }