KeyRoutines
StepFreetext.trim

Trim spaces and stray characters from text on Windows

Trim text cleans the edges of a text, removing spaces and line breaks from the start, the end or both. It's the quiet fix for copied values that don't compare the way you expect.

How it works

  • Give it the text and choose which ends: both, start or end.
  • By default it removes spaces and line breaks; the advanced option trims other characters instead, like / or .,
  • It returns the tidied text.

Routines that use it

Clean copied codes

Trim clipboard text before typing it with Type text so no stray space slips in.

Folder paths

Trim a trailing / from a path before Create folder.

Reliable checks

Trim a line read from a file before testing it with Compare values.

Settings

SettingWhat it does
TextThe text to tidy.
FromWhich ends to trim.
CharactersadvancedTrim these characters instead of spaces and line breaks, such as "/" or ".,".

Good to know

  • It only trims the ends, not spaces in the middle; use Replace text for those.

Questions

How do I remove spaces at the end of text?
Use Trim text with From set to end.
Can I trim characters other than spaces?
Yes. Put them in the advanced characters field, for example / or a full stop.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.