我正在用C#编程,并定义了一个二维数组:
holidays[1, 1] = "元旦";
holidays[2, 14] = "情人节";
holidays[3, 8] = "妇女节";
holidays[3, 12] = "植树节";
holidays[4, 1] = "愚人节";
holidays[5, 1] = "劳动节";
holidays[5, 4] = "青年节";
holidays[5, 12] = "护士节";
holidays[5, 14] = "母亲节";
holidays[5, 14] = "助残日";如何判断值为空?
holidays[i,j] != string.Empty对asp.net无影响。
发布于 2013-12-09 08:53:28
如果在文本之间没有空格,也可以使用
!string.IsNullOrWhitespace(holidays[i, j])根据文件,string.IsNullOrWhitespace的评估结果是:-
return String.IsNullOrEmpty(value) || value.Trim().Length == 0;String.IsNullOrWhitespace方法
指示指定的字符串是空的还是空的,还是仅由空白字符组成.
发布于 2013-12-09 08:38:25
试着使用:
!string.IsNullOrEmpty(holidays[i, j])https://stackoverflow.com/questions/20466282
复制相似问题