icon picker
Trim Text With Links

Currently, the Trim() formula strips links out of text content. As a workaround, you can find the first and last non-space indices in the string, and use the Middle() formula to remove whitespace at the beginning and end of the string.
The formula I have written defines a few variables with the new WithName() formula and then uses them to select the middle of the string:
WithName(
thisRow.[Original Text].Split(''),
CharacterList,
WithName(
CharacterList.Find(CharacterList.Filter(CurrentValue!=' ').First()),
FirstNonSpaceIndx,
WithName(
CharacterList.Find(CharacterList.Filter(CurrentValue!=' ').Last()),
LastNonSpaceIndx,

thisRow.[Original Text].Middle(FirstNonSpaceIndx, LastNonSpaceIndx-FirstNonSpaceIndx + 1)

)))
Original Text
Trimmed Text
1
This is some text with a
and leading and trailing spaces.
This is some text with a
and leading and trailing spaces.
There are no rows in this table

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.