当前位置: 移动技术网 > IT编程>开发语言>c# > C# 判断字符串第一位是否为数字

C# 判断字符串第一位是否为数字

2019年07月18日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:using system;using system.collections.generic;using system.componentmodel;us

复制代码 代码如下:

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.linq;
using system.text;
using system.windows.forms;
using system.text.regularexpressions;

namespace windowsformsapplication1
{
public partial class form1 : form
{
public form1()
{
initializecomponent();
}

private void button1_click(object sender, eventargs e)
{
regex regchina = new regex( "^[^\x00-\xff]");
regex regnum = new regex( "^[0-9]");
regex regchar = new regex( "^[a-z]");
regex regdchar = new regex( "^[a-z]");
string str = "yl闫磊";
if (regnum.ismatch(str))
{
messagebox.show( "是数字");
}
else if (regchina.ismatch(str))
{
messagebox.show( "是中文");
}
else if (regchar.ismatch(str))
{
messagebox.show( "小写");
}
else if (regdchar.ismatch(str))
{
messagebox.show( "大写");
}
}
}
}

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网