Converts any uppercase characters in a CHARACTER or LONGCHAR expression to lowercase characters, and returns the result.
This procedure finds a Customer record. After the user updates the SalesRep field, the procedure converts the first character of the SalesRep value to uppercase and the remaining characters to lowercase.
r-lc.p
REPEAT: PROMPT-FOR Customer.CustNum. FIND Customer USING Customer.CustNum. DISPLAY Customer.Name. UPDATE Customer.SalesRep. Customer.SalesRep = CAPS(SUBSTRING(Customer.SalesRep, 1, 1) ) + LC(SUBSTRING(Customer.SalesRep, 2) ). DISPLAY Customer.SalesRep. END. |
The CAPS function uses the SUBSTRING function to extract the first character of the field, which it then converts to uppercase.
In the LC function, the result of the SUBSTRING function is the remaining characters in the SalesRep field, starting with character position 2. (No length is specified, so the remainder of the string is assumed). The LC function converts these characters to lowercase.