Introduction IB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

ADJUSTL and ADJUSTR functions

Syntax: ADJUSTL(string-argument)

ADJUSTR(string-argument)

Discussion: The ADJUSTL and ADJUSTR functions left- and right-justify, respectively, a string argument.

The string argument may be a string constant, a single-element string variable, a string array element, a string expression or a string function.

The ADJUSTL function removes leading blanks from the string argument and appends trailing blanks to retain the original string argument length.

The ADJUSTR function removes trailing blanks from the string argument and inserts an equal number of leading blanks to retain the original string argument length.

Note: ADJUSTL and ADJUSTR do not alter string length.

Example 1:
A$ = ADJUSTL(B$)

If B$ = "  ABC" (notice the leading blank spaces), the ADJUSTL
function yields A$ = "ABC  " (notice the trailing blanks).
Example 2:
A$ = ADJUSTR(B$)

If B$ = "ABC  " (notice the trailing blank spaces), the ADJUSTR
function yields A$ = "  ABC" (notice the leading blanks).