Check if a string has at least one number in it using LINQ

后端 未结 5 993
既然无缘
既然无缘 2020-12-04 21:07

I would like to know what the easiest and shortest LINQ query is to return true if a string contains any number character in it.

5条回答
  •  不知归路
    2020-12-04 21:23

    How about this:

    bool test = System.Text.RegularExpressions.Regex.IsMatch(test, @"\d");
    

提交回复
热议问题