SoFunction
Updated on 2025-03-08

C# determines whether a string is a number (instance)

Without further ado, please see the code

/// <summary>
/// Determine whether the string is a number/// </summary>
public static bool IsNumber(string s)
{
 if ((s)) return false;
 const string pattern = "^[0-9]*$";
 Regex rx = new Regex(pattern);
 return (s);
}

The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!