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!

Title Case

Status
Not open for further replies.

Sambo8

Programmer
May 10, 2005
78
NZ
Hi All,

I found the following formula in thread767-568676. Also a comment from lindss saying he had found a problem in the script - I've also come accross the same bug where only on the 2nd word in the string it takes the first letter and adds it in again. The formula as follows:

StringVar Original := {SINVOICED.ITMDES1_0};
NumberVar Temp;
numberVar SPointer := 1;
numberVar EPointer := length(original);

Original := uppercase (left({SINVOICED.ITMDES1_0},1)) +
lowercase (right({SINVOICED.ITMDES1_0}, length({SINVOICED.ITMDES1_0}) -1));

While SPointer < EPointer do
(
Temp := instr(Spointer,original, " ");
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;

Any ideas?

Cheers

Sam

 
You could try this:

StringVar Original := {SINVOICED.ITMDES1_0};
NumberVar Temp;
numberVar SPointer := 1;
numberVar EPointer := length(original);

Original := uppercase (left({SINVOICED.ITMDES1_0},1)) +
lowercase (right({SINVOICED.ITMDES1_0}, length({SINVOICED.ITMDES1_0}) -1));

While SPointer < EPointer do
(
Temp := instr(Spointer,original, " ");
if Temp > 0 then
(
Original := left(Original,Temp) +
uppercase(mid(original,temp+1,1)) +
Right(Original,EPointer - temp-1);//note change to temp-1
SPointer := Temp + 1;
)
else
(
SPointer := EPointer ;
);
);
Original;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top