This commit is contained in:
mmrbnjd
2025-07-31 19:05:58 +03:30
parent 38031b2e81
commit 23c4bc2800
3 changed files with 112 additions and 64 deletions

View File

@@ -38,7 +38,19 @@ namespace Common.Validation
public static bool CheckUsername(this string Username)
=> (Username.Length == 11 && Username.StartsWith("09"))
|| (Username.Length == 9 && Username.StartsWith("E/"));
public static bool CheckMobile(this string Mobile) => Mobile.Length == 11 && Mobile.StartsWith("09");
public static bool CheckMobile(this string Mobile)
{
bool pars = true;
foreach (var item in Mobile.ToCharArray())
{
if(!Int32.TryParse(item.ToString(),out int _))
{
pars = false;
break;
}
}
return pars && Mobile.Length == 11 && Mobile.StartsWith("09");
}
public static bool IsValidEmail(this string email)
{
// الگوی ساده اما معتبر برای بررسی ایمیل