IsNullOrEmpty与IsNullOrWhiteSpace区别

时间:2023-03-08 22:19:51
IsNullOrEmpty与IsNullOrWhiteSpace区别

IsNullOrEmpty

    public static bool IsNullOrEmpty(String value) {
return (value == null || value.Length == 0);
}
IsNullOrWhiteSpace
    public static bool IsNullOrWhiteSpace(String value) {
if (value == null) return true; for(int i = 0; i < value.Length; i++) {
if(!Char.IsWhiteSpace(value[i])) return false;
} return true;
}

--EOF--

No.304

写于 2014-10-22