Skip to main content
Solved

Reverse string at certain caracter

  • May 31, 2023
  • 4 replies
  • 72 views

antoine.prince
Contributor
Forum|alt.badge.img+4

I have a string column containing lake names in the format ''Blue, Lake'' and I would like to reverse the format to ''Lake Blue''. I somehow can't find a way to reverse a string at the comma. 

 

Is there an easy way to accomplish this using string functions in FME ?

Best answer by dustin

I would use an AttributeSplitter to split on the comma, which will create a list. Then in an AttributeCreator, build your new attribute using the list elements.

image

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.

4 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 627 replies
  • Best Answer
  • May 31, 2023

I would use an AttributeSplitter to split on the comma, which will create a list. Then in an AttributeCreator, build your new attribute using the list elements.

image


antoine.prince
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • 10 replies
  • May 31, 2023

Thank you! That was super easy to implement and worked perfectly.


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3422 replies
  • May 31, 2023

You could also use a StringReplacer, match the word before the comma in one group and the word after the comma in another group and then replace with the matched groups in reverse order

image


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 627 replies
  • May 31, 2023

You could also use a StringReplacer, match the word before the comma in one group and the word after the comma in another group and then replace with the matched groups in reverse order

image

That is slick!😎