Skip to main content
Solved

Reverse string at certain caracter


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

View original
Did this help you find an answer to your question?

4 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 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

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


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • 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
  • May 31, 2023
ebygomm wrote:

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!😎


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings