Skip to content

Commit afb63fb

Browse files
New feature: bool IsAllNumbers(string)
1 parent 54a8b69 commit afb63fb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Check.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ public static bool IsAValidPhilippineMobileNumber(string str)
7373
return Regex.IsMatch(Regex.Replace(str, @"[\s\-\(\)]", ""), pattern);
7474
}
7575

76+
public static bool IsAllNumbers(string str)
77+
{
78+
string numbers = "0123456789";
79+
foreach (char a in str)
80+
{
81+
if (!numbers.Contains(a))
82+
{
83+
return false;
84+
}
85+
}
86+
return true;
87+
}
88+
7689
public static bool HasNumbers(string str)
7790
{
7891
string numbers = "0123456789";

0 commit comments

Comments
 (0)