|
|
@@ -0,0 +1,27 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace HKCardManager |
|
|
|
{ |
|
|
|
public static class Extend |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// |
|
|
|
/// </summary> |
|
|
|
/// <param name="str"></param> |
|
|
|
/// <param name="IsStrict"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public static bool IsMobile(this string str, bool IsStrict = false) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(str)) return false; |
|
|
|
//string regex=@"^1[0123456789]\d{9}$"; |
|
|
|
Regex.IsMatch(str, @"^(1)\d{10}$"); |
|
|
|
string regex = IsStrict ? @"^[1][358]\d{9}$" : @"[1]\d{10}"; |
|
|
|
return Regex.IsMatch(str, regex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |