Previous Topic: RIGHT Function--Retrieve Characters from a String

Next Topic: RPT Function--Repeat a String

RPAD Function--Pad a String on the Right

The RPAD function adds the first character of the specified padding to the end of the string until the source string becomes the specified length.

If the padding is more than one character long, only the first character is used. If the padding is zero length, no padding is added.

If the source is a string, and the padding is not specified, a space is used for padding. If the source is a number and padding is not specified, a zero is used for padding.

Syntax

The RPAD function has the following format:

RPAD(source_string|number, length[, padding]) 

Parameters

The RPAD function accepts the following parameters:

source_string (string)

This parameter can be a number; it is converted to a string.

length (number)

padding (string)

(Optional)

Return Value

The RPAD function returns a string.

Example

Return_value=RPAD('Juan', 5)
Return_value='Juan '

Return_value=RPAD('Juan', 5, 'X')
Return_value='JuanX'

Return_value=RPAD('Juan', 6, 'XY')
Return_value='JuanXX'

Return_value=RPAD(5, 2)
Return_value='50'

Return_value=RPAD(5, 2, ' ')
Return_value='5 '

More information:

CENTER Function--Pad a Source String

LPAD Function--Pad a Source String on the Left


Copyright © 2010 CA. All rights reserved. Email CA about this topic