Code
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text=IsNum("12333we")+"<br/>"+IsNum1("1231233");
}
public static bool IsNum(String str)//速度比较快
{
for (int i = 0; i < str.Length; i++)
{
if (!Char.IsNumber(str, i))
return false;
}
return true;
}
public static bool IsNum1(String str)//速度超级快
{
for (int i = 0; i < str.Length; i++)
{
if (str[i] < '0' || str[i] > '9')
return false;
}
return true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
posted @
2009-01-13 22:26
jianlinglo
阅读(
146)
评论()
编辑
收藏
举报