A new StringUtil method (a rare occurance!): trim() which safely handles null.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2458 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -92,6 +92,14 @@ public class StringUtil
|
|||||||
return (value == null || value.trim().length() == 0);
|
return (value == null || value.trim().length() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@link String#trim} on non-null values, returns null for null values.
|
||||||
|
*/
|
||||||
|
public static String trim (String value)
|
||||||
|
{
|
||||||
|
return (value == null) ? null : value.trim();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the supplied string if it is non-null, "" if it is null.
|
* @return the supplied string if it is non-null, "" if it is null.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user