Overview
TRIM, LTRIM, and RTRIM are string functions that allow you to remove or trim spaces from text. These functions are particularly useful when dealing with data that may have leading, trailing, or extra spaces, which can cause issues in data analysis and reporting.
In simple terms, these functions act like a pair of scissors that cut off unwanted spaces from the beginning, end, or both sides of a text string, leaving you with a clean and tidy piece of data.
Understanding the Syntax
The syntax for the functions are as follows:
- text: The input text or string from which you want to remove leading and trailing spaces.
This function removes all leading and trailing spaces from the given text. For example, if you have a customer name with extra spaces like " John Smith ", TRIM will return "John Smith".
- text: The input text from which you want to remove leading spaces only.
LTRIM trims only the spaces at the beginning of the text. For instance, if you have a product code with extra spaces on the left like " P001", LTRIM will return "P001".
- text: The input string from which you want to remove trailing spaces only.
RTRIM, on the other hand, removes spaces from the end of the text. So, if you have a description with extra spaces on the right like "High-quality product ", RTRIM will return "High-quality product".
For example:
You manage an online retail store, and your product catalog in NetSuite has been populated with data from various suppliers and manual entries. Unfortunately, many of the product descriptions have leading and trailing spaces, making them look inconsistent and unprofessional on your reports and searches.
Formula: TRIM({description})
You can then export the search, then perform a CSV import to update the field values in NetSuite.
-----
If you find this information useful, let us know by reacting or commenting on this post!