LPAD
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Pads the character string corresponding to the first argument on the left with the character string corresponding to the third argument. After the padding, the length of the result is length.
Syntax
|
Notes
- The
first argument to the function must be of type
CHARACTER. The second argument to the function must be of typeINTEGER. The third argument, if specified, must be of typeCHARACTER. If the third argument is not specified, the default value is a string of length 1 containing one blank. - If
L1is the length of the first argument and L2 is the value of the second argument:- If
L1is less than L2, the number of characters padded is equal to L2 minus L1. - If
L1is equal to L2, no characters are padded and the result string is the same as the first argument. - If
L1is greater than L2, the result string is equal to the first argument truncated to the first L2 characters.
- If
- The result is of type
CHARACTER. - If the argument expression evaluates to
NULL, the result isNULL. - The char_expression and pad_expression can contain multi‑byte characters. The length specifies a number of characters.
Example
This
example illustrates two ways to use the LPAD function:
|
Compatibility
Progress extension