PAD

Description

Returns a left- or right-aligned string, padded with spaces.

Syntax

PAD ( SourceField, "L" | "R", width )

Parameter Description
SourceField The string to pad with spaces.
direction The direction to move the source field, as follows:

  • L — Align the source field to the left (pad with spaces on the right)
  • R — Align the source field to the right (pad with spaces on the left)
width The width of the entire string to return after the spaces are added.

Remarks

The width of the entire string to return after the spaces are added; if the value is less than the length of SourceField, the return string is truncated.

Examples

This function returns "Name " (the 4 characters in the word Name followed by 6 spaces):      

PAD("Name", "L", 10)

This function returns " Name" (6 spaces preceding the 4 characters in the word Name):      

PAD("Name", "R", 10)

These functions both return "Na" (Name is truncated) since Width (2) is less than the length of SourceField:  

PAD("Name", "R", 2)

PAD("Name", "L", 2)

See also

TRIM