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!

Converting Uppercase to Mixed Case

Status
Not open for further replies.

rsims

Programmer
Sep 25, 2000
12
US
I have data all in uppercase and I need to convert mixed case. For example:

1. I need the first letter to be Caps followed by all lower case the field is a PIC X(35). See example below:

INPUT: REINVEST DIVIDEND EXCHANGE
CHANGE IT TO: Reinvest dividend exchange


2. I need the first letter of every work to be Caps followed by lower case the field is a Pic x(45). See example below:

INPUT: NEW YORK STATE NATIONAL BANK
CHANGE IT TO: New York State National Bank

Thanks!
Your help is greatly appreciated [sig][/sig]
 
My procedure ofr handling these types of tasks is to first convert the string to all lower case, (using Funciton Lower-Case) then just change the first character (using reference modification and Funciton Upper-Case) or to change each word, unstring, change and restring. [sig][/sig]
 
Hi,

the following is not tested code but just to give you an idea:

perform varying sub-search from 1 by 1 until sub-search > ##
if string-to-convert (sub-search:1) not = space
inspect string-to-convert (sub-search:1) converting "abcde..." to "ABCDE..."
add +1 to sub-search
if string-to-convert (sub-search:1) not = space
move sub-search to sub-start
perform varying sub-search from sub-start + 1 by +1 until sub-search > ## or string-to-convert (sub-search:1) = space
inspect string-to-convert (sub-start : sub-search - sub-start)
converting "ABCDE...." to "abcde..."
end-perform
end-if
end-if
end-perform

The ## is the maximum value of your string-to-convert.
It can be smart to make the string-to-convert a little bit longer than the longest string to process to avoid problems.

success! [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top