Determines whether the given string is a positive integer.
using System.Text.RegularExpressions;
public static class Extensions
{
public static bool IsPositiveInteger(this string s)
{
Regex regex = new Regex(@"^\d*$");
return regex.IsMatch(s);
}
}
3 Kommentare zum Snippet