Results 1 to 3 of 3

Thread: Initial Caps

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    San Jose, CA
    Posts
    73

    Smile Initial Caps

    VB gurus,

    How do I set Initial Capitol letters on a string? I know
    the command in SQL is "initcap(string)", but that doesn't
    work in VB 6.0. Any clues?

    Andrew


    *** Thanks JHausmann ***
    *** Your solution worked. ***

    [Edited by aatwell on 09-07-2000 at 04:46 PM]

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Give this a run:

    Dim sSource as string
    Dim sResult as string

    sResult = Ucase(Left(sSource,1)) & mid(sSource,2,len(sSource))


  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    This might be easier if you have multiple words in a string that must be converted to proper case all at once:

    Code:
        Dim strMyString As String
        
        strMyString = "hello world"
        
        strMyString = StrConv(strMyString, vbProperCase)
        
        MsgBox strMyString  'gives us "Hello World"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width