手机号码不以0验证开头 [英] Mobile Number does not start with 0 Validation

查看:198
本文介绍了手机号码不以0验证开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

手机号码textbox1。



该手机号码用户未输入以0开头的手机号码。



用于验证代码。



Mobile Number textbox1.

in that mobile Number user does not type the mobile number start with 0.

for that i validate the code.

if(txt_mobile.Text.StartsWith = 0)
{
Label6.Text = "Enter Correct Mobile Number";
 return;
}







i写上面的代码,但错误显示如下;



无法分配给''StartsWith''因为它是''方法组''。



来自我的上面代码是什么错误。




i written the above code but error shows as follows;

Cannot assign to ''StartsWith'' because it is a ''method group''.

from my above code what is the error.

推荐答案

您好,我强烈建议您检查字符串的开头是否有空行



因此

Hi , i strongly recommend to you to check if there is any empty line in the beginin of the string

so as a result
if(txt_mobile.Text.TrimStart().StartsWith("0"))
{
Label6.Text = "Enter Correct Mobile Number";
return false;
}


if(txt_mobile.Text.StartsWith("0"))
{
Label6.Text = "Enter Correct Mobile Number";
return false;
}


这篇关于手机号码不以0验证开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆