C#?ж???????????????????
???????????? ???????[ 2012/12/3 10:07:13 ] ????????
?????????????????????????????ж??
??????????????????????????????????????????????Regex???isMatch()????????????System.Text.RegularExpressions; ?????????using System.Text.RegularExpressions;?????????????????Regex?????????????System.Text.RegularExpressions.Regex ???????
protected bool isNumberic(string message??out int result)
{
System.Text.RegularExpressions.Regex rex=
new System.Text.RegularExpressions.Regex(@"^d+$");
result = -1;
if (rex.IsMatch(message))
{
result = int.Parse(message);
return true;
}
else
return false;
}
???????????????ж??????????????????????????ж????????????о??????????ж????????λ?????????????Email?????????????????????????
protected void Button1_Click(object sender?? EventArgs e)
{
string message = TextBox1.Text.Trim();
isNumeric(message); //?ж??????????5??????????
}
protected void isNumeric(string message)
{
if (message != "" && Regex.IsMatch(message?? @"^d{5}$"))
{
//???
Page.ClientScript.RegisterStartupScript(this.GetType()?? ""?? "<script>alert('??????????????λ???????????')</script>");
}
else
//???
Page.ClientScript.RegisterStartupScript(this.GetType()?? ""?? "<script>alert('???????')</script>");
}
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11