Loading
Extend Salesforce with Clicks, Not Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          LPAD

          LPAD

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

          Use

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

          • text is the field or expression you want to insert characters to the left of.
          • padded_length is the number of total characters in the text that’s returned.
          • pad_string is the character or characters that are inserted. 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

          Leading blank spaces and zeros are omitted.

          Field Name Example: Padding
          Field Name Example: Padding

          LPAD(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

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

          Field Name Example: Padded with Z
          Field Name Example: Padded with Z

          LPAD(Name, 15, 'z') returns the name “zmycompany.com.”

          Field Name Example: Truncating Ex
          Field Name Example: Truncating Ex

          LPAD(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