Is String A UK Post Code

    Public Function IsPostCode(strPCOde As String) As Boolean
        On Error GoTo Err_Fail
        'Protect Against Empty String
        If Len(strPCOde) < 5 Then
            IsPostCode = False
            Exit Function
        End If
        IsPostCode = False
        'Remove Spaces
        strPCOde = strPCOde.Replace(" ", "")
        ' Check For Formats > 5,6 or 7
        If Len(strPCOde) > 4 Or Len(strPCOde) < 8 Then
            'First And Last Chars Should Be Alpha
            If IsNumeric(Mid(strPCOde, 1, 1)) = False And IsNumeric(Mid(strPCOde, Len(strPCOde), 1)) = False Then
                'Third Digit Shouild Be Numeric (With One Exception)
                If IsNumeric(Mid(strPCOde, 3, 1)) = True Then
                    IsPostCode = True
                Else
                    'Test London Based Postcode Option
                    If IsNumeric(Mid(strPCOde, 4, 1)) = True Then IsPostCode = True
                End If
            End If
        End If
        Exit Function
Err_Fail:
        MsgBox(ErrorToString)
        IsPostCode = False
    End Function

 

 

Get Filename From Path

    Public Function GetFileName(ByVal filepath As String) As String
        On Error GoTo Err_Fail
        'Get indices of characters directly before and after filename
        Dim slashindex As Integer = filepath.LastIndexOf("\")
        Dim dotindex As Integer = filepath.LastIndexOf(".")
        GetFileName = filepath.Substring(slashindex + 1, dotindex - slashindex - 1)
        Exit Function
Err_Fail:
        MsgBox(ErrorToString)
    End Function

 

Increment Alpha

    Public Function IncrementAlpha(strAplha As String) As String
        'A=65 Z=90
        'Check For Last Letter Available
        If Asc(strAplha) = 90 Then
            IncrementAplpha = "MAX"
            Exit Function
        End If
        'Can Extend A-Z To Include a-z Here If Required
        IncrementAplpha = Chr(Asc(strAplha) + 1)
    End Function

 

Mixed Formatting

        'Remove Spaces
        strPCOde = strPCOde.Replace(" ", "")
        'Convert To UpperCase
        strPCOde = StrConv(strPCOde, VbStrConv.Uppercase)

SpaceFooter
Website_Design_NetObjects_FusionWeb
 Counter

www.CarlsPlace.co.uk

This Is A United Kingdom Site...