first letter to uppercase

N

Nacho

i need to convert the first letter of a veriable to uppercase (the veriable
is loaded and the applied LCase() )

thanks
 
D

Dominique

I did this function and I use it to convert a string to PROPER CASE (first
letetr cap)

So we got LCASE()
and UCASE()

now we got PCASE :0)

pCase("this iS my string") ====> "This Is My String"
pCase("variablename") ====> "Variablename"
or
sVar = "variablename"

pCase(sVar) =====> "Variablename"

have fun!

function pCase(str) 'Check the cAsE on that
putCap = True 'First Letter Gonna be
Caps
myString = trim(str) 'Remove Leading and
Trailing Spaces
sInc = Chr(32) & Chr(9) & Chr(13) 'Charaters we look for (found
their char codes online sumwhere)
for iLen = 1 to Len(myString) 'Check each Character
mStr = Mid(myString, iLen, 1)
if putCap = true then 'From previous run -->
instructed to make this a UCASE char
bStr = bStr & UCASE(mStr)
else
bStr = bStr & LCase(mStr) 'LCASE char
end if
if instr(sInc, mStr) then 'Check if this is one
of our 'Triggers'(like a space or carriage return or tab)
putCap = true
else
putCap = false
end if
next
pCase = bStr 'eH Voila!
end function
 
H

Hans

Not sure if this is what you want but here we go...

yourVariable = "text in lower case"
yourVariable=Ucase(mid(yourVariable,1,1)) & mid(yourVariable,2)

You may have to take care of null values.

Regards
/Hans
 
E

Evertjan.

Hans wrote on 05 apr 2004 in microsoft.public.inetserver.asp.general:
yourVariable = "text in lower case"
yourVariable=Ucase(mid(yourVariable,1,1)) & mid(yourVariable,2)

yourVariable=Ucase(left(yourVariable,1)) & mid(yourVariable,2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top