[英]coding for email address validation in xamarin.android visual studio 2015?
what is the coding of email address validation using C# in xamarin.android visual studio 2015 and also tell me if any name space is requried? xamarin.android visual studio 2015中使用C#进行电子邮件地址验证的编码是什么,还告诉我是否需要任何名称空间? please tell me all the imp step as well as coding for email address validation in edittext.
请告诉我所有的imp步骤以及在edittext中进行电子邮件地址验证的编码。 i am new in android.xamarin.. guys please help me
我是android.xamarin的新手。.伙计们请帮帮我
You can use Regex for email validation. 您可以使用Regex进行电子邮件验证。
First add following using statement 首先添加以下using语句
using System.Text.RegularExpressions;
And after that use following helper method for validation: 然后使用以下辅助方法进行验证:
Regex EmailRegex = new Regex (@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
public bool ValidateEmail(string email)
{
if (string.IsNullOrWhiteSpace(email))
return false;
return EmailRegex.IsMatch(email);
}
Option 2: 选项2:
Xamarin.Android
has a helper method for email validation you also use that: Xamarin.Android
具有用于电子邮件验证的辅助方法,您也可以使用以下方法:
Android.Util.Patterns.EmailAddress.Matcher(email).Matches();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.