LCWORD: Converting a String to Mixed-Case

How to:

Available Languages: reporting, Maintain

The LCWORD function converts the letters in a character string to mixed-case. It converts every alphanumeric character to lowercase except the first letter of each new word and the first letter after a single or double quotation mark, which it converts to uppercase. For example, O'CONNOR is converted to O'Connor and JACK'S to Jack'S.

LCWORD skips numeric and special characters in the source string and continues to convert the following alphabetic characters. The result of LCWORD is a string in which the initial uppercase characters of all words are followed by lowercase characters.

Syntax: How to Convert a Character String to Mixed-Case

LCWORD(length, source_string, output)

where:

length

Integer

Is the number of characters in source_string and output.

string

Alphanumeric

Is the character string to be converted enclosed in single quotation marks, or a field or variable containing the character string.

output

Alphanumeric

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks. The length must be greater than or equal to length.

Example: Converting a Character String to Mixed-Case

LCWORD converts the LAST_NAME field to mixed-case and stores the result in MIXED_CASE.

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND COMPUTE
MIXED_CASE/A15 = LCWORD(15, LAST_NAME, MIXED_CASE);
WHERE DEPARTMENT EQ 'PRODUCTION'
END

The output is:

LAST_NAME        MIXED_CASE
---------        ----------
STEVENS          Stevens
SMITH            Smith
BANNING          Banning
IRVING           Irving
ROMANS           Romans
MCKNIGHT         Mcknight