简单判断邮箱格式 contains包括 IndexOf(“@”)
2015-04-03 08:50
288 查看
namespace ConsoleApplication2 { class Program { static void Main(string[] args) { while (true) { string email = Console.ReadLine(); if (email.Contains("@") && (email.Contains(".com") || email.Contains(".cn")))//是否包括@、.com、.cn { int index = email.IndexOf("@");//IndexOf查找“@”在第几个下标 Console.WriteLine("您输入的邮箱正确!"); Console.WriteLine("您的邮箱用户名为:" + email.Substring(0, index)); } else { Console.WriteLine("您输入的邮箱不正确!"); } } } } }
相关文章推荐
- 例题:判断邮箱格式。重点学习contains, IndexOf(返回某个值的第一个匹配项的从零开始的索引)
- python3 中简单的邮箱格式判断
- JS(JavaScript)判断邮箱格式是否正确
- js判断邮箱代码格式
- java 判断电话号码,邮箱格式是否正确
- checkEmail判断邮箱格式
- 【iOS】判断邮箱格式是否正确的代码
- zju1081 判断点是否在简单多边型内(包括凹的情况)
- JavaScript 判断用户输入的邮箱及手机格式是否正确
- java 获取邮箱和及判断邮箱格式
- 判断是否为邮箱格式
- oracle正则判断是否为邮箱格式字段
- js判断邮箱代码格式
- 用正则表达式搭配JS判断邮件/邮箱地址格式
- 仿凤凰网的注册页面,javascript完成简单的空/邮箱格式/字符串的长度校验 ajax完成服务器端是否同名校验
- ios正则表达式判断邮箱格式是否正确
- ASP中用正则表达式判断邮箱格式
- JS判断邮箱格式,密码输入是否一致,不能为空,长度控制等
- iPhone开发判断邮箱格式是否合法
- iOS开发有用代码(有判断邮箱格式是否正确的代码、图片压缩、亲测可用的图片上传代码和实现点击图片进行跳转的代码等。)