regular expression for anything but an empty string

前端 未结 9 1001
予麋鹿
予麋鹿 2020-11-29 01:22

Is it possible to use a regular expression to detect anything that is NOT an \"empty string\" like this:

string s1 = \"\";
string s2 = \" \";
string s3 = \"          


        
9条回答
  •  [愿得一人]
    2020-11-29 01:56

    You could also use:

    public static bool IsWhiteSpace(string s) 
    {
        return s.Trim().Length == 0;
    }
    

提交回复
热议问题