Jump to content

[VB6]ProperCase String

- - - - -

  • Please log in to reply
No replies to this topic

#1
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
Ok 3 Days ago i was playing with one of my old functions that i have used in some of my applications and while my skills have grown i made the function much smaller and i can make it even more smaller but this looks good atm
ok i know that this function is already impremented in visual basic 6 but if you want be a good coder you should try to code your functions alone

ok this function helps you show every first letter behind a space in uppercase

sorry for my bad english :D

Public Function ProperCaseString(StringWithSpaces As String)

    

    Dim TheName()  As String

    Dim TheAName() As String

    Dim TheFinal   As String

    Dim i          As Long

    

    TheName() = Split(StringWithSpaces, " ")

    TheAName() = Split(StringWithSpaces, " ")


    For i = 0 To UBound(TheName)

    

        TheName(i) = UCase$(Left$(TheName(i), 1))

        TheAName(i) = Right$(TheAName(i), Len(TheAName(i)) - 1)

        TheFinal = TheFinal & TheName(i) & TheAName(i) & " "

    Next


    ProperCaseString = TheFinal


End Function

Posted Image




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users