First Letter Capitalized...

# Thread: First Letter Capitalized...

1. Senior Member
Join Date
Dec 1969
Posts
666

## First Letter Capitalized...

I&#039;m trying to capitalized the first letter only of a string.<BR>This is what I got so far:<BR>UCase(Left((city),1))<BR><BR>But what I&#039;m getting is Just the first Letter ONLY (D insted of David) of the string and capitalized. What did I miss?

2. Senior Member
Join Date
Dec 1969
Posts
590

## RE: First Letter Capitalized...

UCase(Left(city,1))& mid(city,2)<BR>

3. Senior Member
Join Date
Dec 1969
Posts
666

## Thanks man! Will that work

even If I have a string like that:<BR>los angeles area

4. Senior Member
Join Date
Dec 1969
Posts
1,015

## RE: Thanks man! Will that work

for Los Angeles Area:<BR><BR>[code language="VBScript"]<BR>Function PCase(strInput)<BR> Dim iPosition<BR> Dim iSpace<BR> Dim strOutput<BR><BR> iPosition = 1<BR> <BR> Do While InStr(iPosition, strInput, " ", 1) &#060;&#062; 0<BR> iSpace = InStr(iPosition, strInput, " ", 1)<BR> strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))<BR> strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition))<BR><BR> iPosition = iSpace + 1<BR> Loop<BR><BR> strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))<BR> strOutput = strOutput & LCase(Mid(strInput, iPosition + 1))<BR><BR> PCase = strOutput<BR>End Function<BR><BR>&#039;returns Los Angeles Area<BR>Response.write pCase("los angeles area")<BR>[/code]<BR><BR>there ya go... :-)

5. Senior Member
Join Date
Dec 1969
Posts
666

## RE: Thanks man! Will that work

Thanks man!

#### Posting Permissions

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