如何检查是字母数字 [英] how to check is alphanumeric

查看:72
本文介绍了如何检查是字母数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想检查字符串是否为字母数字

want to check wether the string is alphanumeric or not

推荐答案

Hello Vijay,

试试这个

字母数字是字母和数字字符的组合。字母数字字符集由数字0到9和字母A到Z组成。例如,这些是字母数字:Vijay1。

Dot Net为我们提供名称空间System.Text 下正则表达式的概念。您也可以使用解决方案1.但我打算使用RegularExpression。你可以根据你的标准修改正则表达式:

Hello Vijay,
Try This
Alphanumeric is a combination of alphabetic and numeric characters.The alphanumeric character set consists of the numbers 0 to 9 and letters A to Z. for example these are the alphanumeric : Vijay1.
Dot Net Provides us the concept of Regular Expressions Under the Name Space System.Text . You Can Use Solution 1 as well.But i Intend to use RegularExpression. you can Modify Regular expression according to ur Criteria:
Private Function IsAlphaNum(ByVal strInputText As String) As Boolean
      Dim IsAlpha As Boolean = False
      If System.Text.RegularExpressions.Regex.IsMatch(strInputText, "^[a-zA-Z0-9]+


然后
IsAlpha = True
否则
IsAlpha = FALS e
结束 如果
返回 IsAlpha
结束 功能
") Then IsAlpha = True Else IsAlpha = False End If Return IsAlpha End Function



^ [a-zA-Z0-9] +


"^[a-zA-Z0-9]+


是一个正则表达式。它告诉你一个字符串可以从大写字符,小字符或者数字并且可以包含超过1个字符的组合。
" is a Regular Expresiion.It Tells u a string can start from capital Characters,Small Characters Or Numbers and can contain combination of more then 1. Characters.


这篇关于如何检查是字母数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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