Skip to main content
Solved

Remove Trailing Spaces

  • May 25, 2016
  • 3 replies
  • 573 views

Forum|alt.badge.img

Hi there,

I want to remove all spaces after a string. Example:

TestString1[ ]TestString2[   ] 

whereas only the empty spaces after TestString2 should be removed.

I have a solution for removing leading spaces with the StringReplacer which is ^[\s]* but I want to remove only the empty spaces at the end.

Many thanks and kind regards

Thomas

Best answer by jdh

Use an AttributeTrimmer with Trim Type Right and Trim Characters {space}

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • Best Answer
  • May 25, 2016

Use an AttributeTrimmer with Trim Type Right and Trim Characters {space}


jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • May 25, 2016

Use an AttributeTrimmer with Trim Type Right and Trim Characters {space}

If you wanted to go the regex route it would be [\\s]*$


Forum|alt.badge.img
  • Author
  • May 25, 2016

Many thanks @jdh The AttributeTrimmer works perfectly! I had forgotten how many wonderfuly transformers FME has on board :) And thank you also for the tip with the regex, have to learn this topic very soon :)