using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace IsNullOrEmptyDemo
{
class Program
{
static void Main(string[] args)
{
string text = " ";
Console.WriteLine(IsNullOrEmpty(text));
Console.WriteLine(string.IsNullOrEmpty(text));
Console.Read();
}
static bool IsNullOrEmpty(string text)
{
if (text == null)
return true;
return !Regex.IsMatch(text, @"\S");
}
}
}
c#判断是否为NULL或空
最新推荐文章于 2021-03-06 17:26:58 发布