/// <summary>
/// 从字符串中提取手机号码,多个用“,”分开
/// </summary>
/// <param name="MobilePhone">字符串</param>
/// <returns></returns>
public static string IsLegalMobilePhone(String MobilePhone)
{
Regex myReg = new Regex(@"[1][3,5,8]\d{9}");
if (MobilePhone.ToString() == "" || MobilePhone.ToString() == null)
{
return string.Empty;
}
else
{
if (myReg.IsMatch(MobilePhone))
{
string ps = "";
var match=myReg.Matches(MobilePhone);
foreach (Match item in match)
{
if (string.IsNullOrEmpty(ps))
ps += item.Value;
else
ps += "," + item.Value;
}
return ps;
}
else
return string.Empty;
}
}
/// 从字符串中提取手机号码,多个用“,”分开
/// </summary>
/// <param name="MobilePhone">字符串</param>
/// <returns></returns>
public static string IsLegalMobilePhone(String MobilePhone)
{
Regex myReg = new Regex(@"[1][3,5,8]\d{9}");
if (MobilePhone.ToString() == "" || MobilePhone.ToString() == null)
{
return string.Empty;
}
else
{
if (myReg.IsMatch(MobilePhone))
{
string ps = "";
var match=myReg.Matches(MobilePhone);
foreach (Match item in match)
{
if (string.IsNullOrEmpty(ps))
ps += item.Value;
else
ps += "," + item.Value;
}
return ps;
}
else
return string.Empty;
}
}