Xbasic

PADC Function

Syntax

Formatted_String as C = PADC(C,N length,C pad_string)

Arguments

C

A character string.

length

A positive integer representing the length of the Formatted_String. If Length is less than len(Unformatted_String), then Unformatted_String will be truncated to Length. Numeric

pad_string

The character string to append to the beginning and end of Unformatted_String to center it within Formatted_String.

Description

Pads both sides of a string with another string.

Discussion

PADC() pads a C_string on both sides with the Pad_String and returns a string of the specified Length. You can use the pad functions to define calculated fields that create titles within reports as shown in the following Example

Example

padc("$" + ltrim( str(AMOUNT) ), 20, "***") -> ***$2000***, if AMOUNT contains 2000
padc("Hello", 10, "_") -> "_Hello"
padc("Hello", 3, "*") -> "Hel"

See Also