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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Upper Case to Title Case 2

Status
Not open for further replies.

Madawc

Programmer
Sep 5, 2002
7,628
GB
Is there some neat method to change an address line from upper case to title case, e.g.
Code:
26 A SLOUGH ROAD
26 A Slough Road
I was doing it with
Code:
if ubound(Split({@ValidStreet}, " ")) = 5
then 
Left(Split({@ValidStreet}, " ")[1], 1)
& Lowercase(Right(Split({@ValidStreet}, " ")[1], (Length(Split({@ValidStreet}, " ")[1])-1)))
& " " & 
Left(Split({@ValidStreet}, " ")[2], 1)
& Lowercase(Right(Split({@ValidStreet}, " ")[2], (Length(Split({@ValidStreet}, " ")[2])-1)))
& " " & 
Left(Split({@ValidStreet}, " ")[3], 1)
& Lowercase(Right(Split({@ValidStreet}, " ")[3], (Length(Split({@ValidStreet}, " ")[3])-1)))
& " " & 
Left(Split({@ValidStreet}, " ")[4], 1)
& Lowercase(Right(Split({@ValidStreet}, " ")[4], (Length(Split({@ValidStreet}, " ")[4])-1)))
& " " & 
Left(Split({@ValidStreet}, " ")[4], 1)
& Lowercase(Right(Split({@ValidStreet}, " ")[5], (Length(Split({@ValidStreet}, " ")[5])-1)))
This failed - and stopped the report - because there were actully two spaces between "A" and "SLOUGH".
Short of replacing double-spaces with single spaces, and likewise for triple spaces etc., is there some way to handle this?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks, I missed the existence of Propercase. Oddly, it's not referenced from either Uppercase or Lowercase.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top