1,字符是否为空,2,比较两个字符大小。String.Compare(String, String)。string.IsNullOrEmpty(string)...
生活随笔
收集整理的這篇文章主要介紹了
1,字符是否为空,2,比较两个字符大小。String.Compare(String, String)。string.IsNullOrEmpty(string)...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1,
String.Compare 方法 (String, String)
比較兩個指定的?String?對象。
| 小于零 | strA?小于?strB。 |
| 零 | strA?等于?strB。 |
| 大于零 | strA?大于?strB。 |
實例:
if (string.Compare(beginDate.ToString("yyyyMMdd"), endDate.ToString("yyyyMMdd")) > 0){throw new GSPException("開始日期不能大于結束日期", ErrorLevel.Info);}?
String.IsNullOrEmpty 方法?(String)
指示指定的字符串是?null?還是?Empty?字符串。
返回值
Type:?System.Boolean
如果?true?參數為?value?或空字符串 (""),則為?null;否則為?false。
?
實例:
if (string.IsNullOrEmpty(ds.Tables["RebatePolicy"].Rows[0]["RebateGuid"].ToString()))throw new GSPException("不是制單狀態,不允許刪除", ErrorLevel.Info);?
轉載于:https://www.cnblogs.com/alsf/p/6206741.html
總結
以上是生活随笔為你收集整理的1,字符是否为空,2,比较两个字符大小。String.Compare(String, String)。string.IsNullOrEmpty(string)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Bootstrap的全局css样式部分
- 下一篇: FreeMarker标签与使用