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

Proper Case 3

Status
Not open for further replies.

dunkyn

Technical User
Apr 30, 2001
194
US
I know how to make a string upper or lower case, but what about title or proper case? I just want to capitalize the first letter of each word. ?
 
try

StringVar result := "";
result := uppercase(left({table.string},1)) +
lowercase(right({table.string}, length({table.string}) - 1));

result;

Jim Broadbent
 
Great work!

That gives me the first word capitalized, but it does not capitalize subsequent words in the same string. ?
 
I will assume a single space between words...this was generic to force smalls after the first letter of a word I will keep that form....If it isn't that way then you will have to modify it....since you haven't given me a selection of possible problems

StringVar Original := {table.string};
NumberVar Temp;
numberVar SPointer := 1;
numberVar EPointer := length(Original);

//take care of the first CAP
Original := uppercase(left({table.string},1)) +
lowercase(right({table.string}, length({table.string}) - 1));

While SPointer < EPointer do
(
Temp := inStr(SPointer,original,&quot; &quot;);
if Temp > 0 then
(
Original := left(Original,Temp) +
uppercase(mid(Original,temp+1,1)) +
Right(Original,EPointer - temp+1);
SPointer := Temp + 1;
)
else
(
SPointer := EPointer ;
);
);

Original;



Jim Broadbent
 
Is the ProperCase function new to CR9?

Thadeus
 
Thx! You make it look so easy! I am impressed!
 
You can download this function for older versions. There is a UFL called U2Lcaps.dll. You can find it on CR's web site. I have an article about this and other UFLs at:


Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
BTW I believe the UFL creates a function called Title Case, not Proper Case, but it is the same.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Thanks. I'll check it out.

If I install this UFL on my PC and use it to create a Crystal Report, will the function deliver the intended results if I share it with others who do not have Crystal or the UFL on their individual PCs?
 
You would have to add the UFL's DLL to the other PC's.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
When I use the formula by Ngolem on 5 Jun 03 for proper case I get the following. Can anyone help? Thanks

THOMAS SMITH becomes: Thomas S Smith
 
Start a new thread and post technical information such as:

Crystal version
Example data
Expected output

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top