标签:ring ati als public case == blog ret bsp
字符串工具类,简单的只有valueOf(传入对象返回字符串,trim清除首尾空格),isNull(传入对象,判断非空,转成字符串判断),isNotNull(!isNull).
public class StringUtils { public static String valueOf(Object o) { if (o == null) { return ""; } String os = o.toString().trim(); if ("null".equalsIgnoreCase(os)) { return ""; } return os; } public static boolean isNull(Object o) { if (o == null) { return true; } String vs = valueOf(o); if (vs.trim().isEmpty() || vs.trim().equals("")) { return true; } return false; } public static boolean isNotNull(Object o) { return !isNull(o); } }
标签:ring ati als public case == blog ret bsp
原文地址:http://www.cnblogs.com/hhhd/p/6604252.html