PDA

Click to See Complete Forum and Search --> : Initial Caps


aatwell
Sep 7th, 2000, 12:08 PM
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]

JHausmann
Sep 7th, 2000, 01:12 PM
Give this a run:

Dim sSource as string
Dim sResult as string

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

Clunietp
Sep 8th, 2000, 10:58 AM
This might be easier if you have multiple words in a string that must be converted to proper case all at once:


Dim strMyString As String

strMyString = "hello world"

strMyString = StrConv(strMyString, vbProperCase)

MsgBox strMyString 'gives us "Hello World"