Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove ALL CAPS from field (string manipulation)

Status
Not open for further replies.

MagnusFox

IS-IT--Management
Jan 12, 2001
51
0
0
US
Good day,

I need to rewrite a field in my DB that is currently ALL CAPS. Here is the Field, sample data and the results I need.

Business Name
THE BELT SHOP
ST. PETER HOGS

After string manipulation:

Business Name
The Belt Shop
St. Peter Hogs

Could you please provide the string manipulation logic needed to complete this task?

Many thanks,
MF
 
hmmm.. lcase(string)

____________________________________________________
[sub][/sub]
onpnt2.gif

 
Easiest is to use CSS -

response.write &quot;<Span style='text-tranform: capitalize;'>&quot; & yourVar & &quot;</span>&quot;


Please note that capitalize only works when the words are all caps (It lowercases all letters not in the first position after a space - it WILL NOT uppercase the first letter if that is not already done)

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Wolf,

I need to store the new values in the DB. Not just print them to the screen.

All,
Please note that the data is currently stored as all uppercase chars, so the lcase can only be applied to the second char and everything up to the next space, then repeat.
 
The you'll need to write a little function....

function caps(inVar)
varArr = split(inVar, &quot; &quot;)
outStr = &quot;&quot;
for x = 0 to uBound(varArr)
outStr = outStr & uCase(left(varArr(x),1)) & lCase(mid(varArr(x),2))
next
caps = outStr
end function


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Thanks Wolf!

Meet you at the hen house around noon for a snack.

Fox
 
rofl, I had to read it twice before I got it :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top