Public Function GetAlphabeticString(ByVal pStrText As String, ByVal pCharCase As TextCases, ByVal pLength As Integer) As String
        If pLength > 0 Then pStrText = trimString(pStrText, pLength)
        Return GetAlphabeticString(pStrText, pCharCase)
    End Function
    Public Function GetAlphabeticString(ByVal pStrText As String, ByVal pCharCase As TextCases) As String
        Select Case pCharCase
            Case TextCases.Upper : mPattern = "^([A-Z]+)$"
            Case TextCases.Lower : mPattern = "^([a-z]+)$"
            Case TextCases.Both : mPattern = "^([A-Za-z]+)$"
        End Select
        If Regex.IsMatch(pStrText, mPattern) Then : Return pStrText
        Else : Return ""
        End If
    End Function
    Public Function GetAlphanumericString(ByVal pStrText As String, ByVal pCharCase As TextCases, ByVal pLength As Integer) As String
        If pLength > 0 Then pStrText = trimString(pStrText, pLength)
        Return GetAlphanumericString(pStrText, pCharCase)
    End Function
    Public Function GetAlphanumericString(ByVal pStrText As String, ByVal pCharCase As TextCases) As String
        Select Case pCharCase
            Case TextCases.Upper : mPattern = "^([A-Z0-9]+)$"
            Case TextCases.Lower : mPattern = "^([a-z0-9]+)$"
            Case TextCases.Both : mPattern = "^([A-Za-z0-9]+)$"
        End Select
        If Regex.IsMatch(pStrText, mPattern) Then : Return pStrText
        Else : Return ""
        End If
    End Function

Like it on Facebook, +1 on Google, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet