Loading
Prepare for Email to Become the Default Login ExperienceRead More
Extend Salesforce with Clicks, Not Code
RPAD

RPAD

Inserts characters that you specify to the right-side of a text string.

Use

RPAD(text, padded_length[, 'pad_string']) and replace the variables:

  • text is the field or expression after which you want to insert characters.
  • pad_length is the number of total characters in the text string that is returned.
  • pad_string is the character or characters to insert. pad_string is optional and defaults to a blank space.

If the value in text is longer than pad_string, text is truncated to the size of padded_length.

Tips

Ending blank spaces are omitted.

Field Name Example: Padding Default
Field Name Example: Padding Default

RPAD(Name, 20) truncates the Name field after 20 characters. For example, if the name is mycompany.com, the value returned is “mycompany.com.”

My Company Example: No Change
My Company Example: No Change

RPAD('my_company.com', 14, 'z') returns “my_company.com” without change because it has 14 characters.

Field Name Example: Padding with a Character
Field Name Example: Padding with a Character

RPAD(Name, 15, 'z') returns “mycompany.comz” .

Field Name Example: Truncating
Field Name Example: Truncating

RPAD(Name, 2) truncates the name after the second character. For example, if the name is mycompany.com, the value returned is “my.”

 
Loading
Salesforce Help | Article