|
IsPositiveInteger as Extension Method
Author:
Jan Welker
|
Programming Language:
C# |
Rating:
not yet rated
|
Views:
2877 |
Description:
Determines whether the given string is a positive integer.
|
|
| C# |
1
2
3
4
5
6
7
8
9
10
|
using System.Text.RegularExpressions;
public static class Extensions
{
public static bool IsPositiveInteger(this string s)
{
Regex regex = new Regex(@"^\d*$");
return regex.IsMatch(s);
}
}
|
|
|
This Snippets could be interesting for you:
|
|
|
|
|
|
|
|
Comments:
(Please log in to write an comment.)
|
|
|