Let's not use trim() here and avoid creating an intermediate object.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2461 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2008-10-24 06:26:56 +00:00
parent ddf70fc45f
commit f0d55037d1
+6 -1
View File
@@ -89,7 +89,12 @@ public class StringUtil
*/
public static boolean isBlank (String value)
{
return (value == null || value.trim().length() == 0);
for (int ii = 0, ll = (value == null) ? 0 : value.length(); ii < ll; ii++) {
if (!Character.isWhitespace(value.charAt(ii))) {
return false;
}
}
return true;
}
/**