Lad os komme i gang
Indtast din arbejds- eller skolekonto for at komme i gang.
Removes extra spaces from a string of text.
The Trim function removes all spaces from a string of text except for single spaces between words.
The TrimEnds function removes all spaces from the start and end of a string of text but leaves spaces between words intact.
If you specify a single string of text, the return value for either function is the string with any extra spaces removed. If you specify a single-column table that contains strings, the return value is a single-column table of trimmed strings. If you have a multi-column table, you can shape it into a single-column table, as working with tables describes.
By trimming spaces between words, Trim is consistent with the function of the same name in Microsoft Excel. However, TrimEnds is consistent with programming tools that trim spaces only from the start and end of each string.
Trim( String )
TrimEnds( String )
Trim( SingleColumnTable )
TrimEnds( SingleColumnTable )
|Trim( " Hello World " )||Removes all spaces from the start and end of a string and extra spaces from within the string.||"Hello World"|
|TrimEnds( " Hello World " )||Removes all spaces from the start and end of a string.||"Hello World"|
The following examples use a single-column collection, named Spaces, that contains these strings:
To create this collection, set the OnSelect property of a Button control to this formula, open Preview mode, and then click or tap the button:
ClearCollect( Spaces, [ " Jane Doe ", " Jack and Jill", "Already trimmed", " Venus, Earth, Mars ", "Oil and Water " ] )
|Trim( Spaces )||Trims all spaces from the start and end of each string and extra spaces from within each string in the Spaces collection.|
|TrimEnds( Spaces )||Trims all spaces from the start and end of each string in the Spaces collection.|
Note: Extra spaces don't appear if you display a collection by clicking or tapping Collections on the File menu. To verify string length, use the Len function.