Regex for numbers only

后端 未结 18 2516
野性不改
野性不改 2020-11-22 03:29

I haven\'t used regular expressions at all, so I\'m having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the

18条回答
  •  孤城傲影
    2020-11-22 04:19

    Perhaps my method will help you.

        public static bool IsNumber(string s)
        {
            return s.All(char.IsDigit);
        }
    

提交回复
热议问题