Return to Snippet

Revision: 19749
at October 29, 2009 23:08 by Shurik76


Initial Code
Function PCase(ByVal strInput)' As String
    Dim I 'As Integer
    Dim CurrentChar, PrevChar 'As Char
    Dim strOutput 'As String

    PrevChar = ""
    strOutput = ""

    For I = 1 To Len(strInput)
        CurrentChar = Mid(strInput, I, 1)

        Select Case PrevChar
            Case "", " ", ".", "-", ",", """", "'"
                strOutput = strOutput & UCase(CurrentChar)
            Case Else
                strOutput = strOutput & LCase(CurrentChar)
        End Select

        PrevChar = CurrentChar
    Next 'I

    PCase = strOutput
End Function

Initial URL
http://www.asp101.com/samples/pcase.asp

Initial Description


Initial Title
Proper Case String Conversion

Initial Tags


Initial Language
ASP