特定文に含まれる文字かの判断をするサンプルプログラムを記載します。

 

'半角数字か判断する
Public Shared Function IsHalfNumeric(ByVal c As Char) As Boolean
    If "0"c <= c And c <= "9"c Then
        Return True
    End If

    Return False
End Function

'半角整数値か判断する
Public Shared Function IsHalfDigit(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse c = "-" OrElse c = "+" Then
        Return True
    End If

    Return False
End Function

'半角実数値か判断する
Public Shared Function IsHalfReal(ByVal c As Char) As Boolean
    If IsHalfDigit(c) OrElse c = "." Then
        Return True
    End If

    Return False
End Function

'半角16進数か判断する
Public Shared Function IsHalfHex(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse ("A"c <= c And c <= "F"c) OrElse ("a"c <= c And c <= "f"c) Then
        Return True
    End If

    Return False
End Function

'半角英文字か判断する
Public Shared Function IsHalfAlpha(ByVal c As Char) As Boolean
    If ("A"c <= c And c <= "Z"c) OrElse ("a"c <= c And c <= "z"c) Then
        Return True
    End If

    Return False
End Function

'半角カナ文字か判断する
Public Shared Function IsHalfKana(ByVal c As Char) As Boolean
    If ("ア"c <= c And c <= "ン"c) Then
        Return True
    End If

    Return False
End Function

'半角表示文字か判断する
Public Shared Function IsHalfDisplay(ByVal c As Char) As Boolean
    If (" "c <= c And c <= "~"c) OrElse ("。"c <= c And c <= "゚"c) Then
        Return True
    End If

    Return False
End Function

'半角日付文字か判断する
Public Shared Function IsHalfDate(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse c <= "/"c Then
        Return True
    End If

    Return False
End Function

'半角時間文字か判断する
Public Shared Function IsHalfTime(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse c <= ":"c Then
        Return True
    End If

    Return False
End Function

'半角電話番号文字か判断する
Public Shared Function IsHalfPhone(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse c <= "-"c Then
        Return True
    End If

    Return False
End Function

'半角郵便番号文字か判断する
Public Shared Function IsHalfPost(ByVal c As Char) As Boolean
    If IsHalfNumeric(c) OrElse c <= "-"c Then
        Return True
    End If
    
    Return False
End Function

'全角カナ文字か判断する
Public Shared Function IsDblKatakana(ByVal c As Char) As Boolean
    Dim s As String = c.ToString()

    If Not System.Text.RegularExpressions.Regex.IsMatch(s, "^[ァ-ヴ!ー]+$") Then
        Return False
    End If

    Return True
End Function

'全角かな文字か判断する
Public Shared Function IsDblHiragana(ByVal c As Char) As Boolean
    Dim s As String = c.ToString()

    If Not System.Text.RegularExpressions.Regex.IsMatch(s, "^[ぁ-ん!ー]+$") Then
        Return False
    End If

    Return True
End Function
'文字コードが半角文字か判断する
Public Shared Function IsHalfChar(ByVal c As Char) As Boolean
    If  Convert.ToInt32(c) <= &HFF Then
        Return True
    End If
    
    Return False
End Function