Skip to main content
Solved

text replace

  • May 14, 2019
  • 3 replies
  • 44 views

terezia86
Forum|alt.badge.img
Hi,
I would like to replace the texts in my excel list (possibly also different formats).
for example:
in Python it looks like this:
in Attribute "street"

def replace(field):

if"straße" in field:

return field.replace("straße", "str.")

elif"Straße" in field:

return field.replace("Straße","Str.")

elif"strasse" in field:

return field.replace("strasse","str.")

elif"Strasse" in field:

return field.replace("Strasse","Str.")

elif"ä" in field:

return field.replace("ä","ae.")

elif"ö" in field:

return field.replace("ö","oe.")

elif"ü" in field:

return field.replace("ü","ue.")

else:

return field

which transformer should I use, and how? I have no experieces with it.
Thanks

Best answer by david_r

You can use the StringReplacer, and possibly also the StringPairReplacer.

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

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • May 14, 2019

You can use the StringReplacer, and possibly also the StringPairReplacer.


terezia86
Forum|alt.badge.img
  • Author
  • 59 replies
  • May 14, 2019

You can use the StringReplacer, and possibly also the StringPairReplacer.

Hi david_r,

 

thanks for reply!

Could you explain me more, pls?

How should I write it? How to edit the parameter?

Thanks


david_r
Celebrity
  • 8394 replies
  • May 14, 2019

Hi david_r,

 

thanks for reply!

Could you explain me more, pls?

How should I write it? How to edit the parameter?

Thanks

I would start by looking at the manual for these two transformers, it's very well explained there:

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/stringreplacer.htm

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/stringpairreplacer.htm

If you have further questions, feel free to post them here.