zoukankan      html  css  js  c++  java
  • VB.NET全角半角check

        ''' <summary>
        ''' 半角英数のチェック
        ''' </summary>
        ''' <param name="str"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function f_IsAlphameric(ByVal str As String) As Boolean
            Return Regex.IsMatch(str, "^[a-zA-Z0-9]+$")
        End Function

        ''' <summary>
        ''' 半角カタカナ
        ''' </summary>
        ''' <param name="str"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function f_IsHankakuKana(ByVal str As String) As Boolean
            Return Regex.IsMatch(str, "[\uFF61-\uFF9F]")
        End Function

        ''' <summary>
        ''' 半角記号
        ''' </summary>
        ''' <param name="str"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function f_IsHankakuKigou(ByVal str As String) As Boolean
            Return Regex.IsMatch(str, "^[ -/:-@\[-\`\{-\~]+$")
        End Function

        ''' <summary>
        ''' 半角カナ・半角英数字・半角記号チェック
        ''' </summary>
        ''' <param name="str"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function f_IsHankakuKanaOrAlphamericOrKigou(ByVal str As String)
            For Each s_code As String In str
                If Not (f_IsHankakuKana(s_code) OrElse f_IsAlphameric(s_code) OrElse f_IsHankakuKigou(s_code)) Then
                    Return False
                End If
            Next
            Return True
        End Function

        ''' <summary>
        ''' 全角チェック
        ''' </summary>
        ''' <param name="str"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function f_IsZenkaku(ByVal str As String) As Boolean
            Return Regex.IsMatch(str, "^[^ -~。-゚]+$")
        End Function

  • 相关阅读:
    C51 使用端口 个人笔记
    C51 静态数码管 个人笔记
    C51 矩阵按键 个人笔记
    C51 蜂鸣器 个人笔记
    C51 独立按键 个人笔记
    C51 中断 个人笔记
    CC3200 TI 笔记
    iar修改包含路径的方法
    WCF绑定和行为在普通应用和SilverLight应用一些对比
    用批处理来自动化项目编译及部署(附Demo)
  • 原文地址:https://www.cnblogs.com/justinsun/p/2211206.html
Copyright © 2011-2022 走看看