Skip to main content

Hi, I'm trying to insert a decimal into a string of numbers, so 123456 becomes 1234.56

 

Thanks!

Hey there @dos_gis​, You can do this a few different ways. You could use regex inside the stringreplacer transformer like mentioned here -

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

or the stringinserter custom transformer

https://hub.safe.com/publishers/safe-lab/transformers/stringinserter

 

Here's a super helpful resource I use when working with regex - https://regex101.com/

---

If i've provided something helpful, please upvote the comment. If i've provided a solution, please mark it as 'Best Answer'. This marks the post as answered and helps the community find the solution. If I didn't provide a solution, please let me know if I can help further. Thanks! 🙂


Thanks. I've been trying the stringreplacer with regex:

[0-9]{2}+$

Replacement Text: .\\2

 

It's not adding the decimal just replacing the text


Thanks. I've been trying the stringreplacer with regex:

[0-9]{2}+$

Replacement Text: .\\2

 

It's not adding the decimal just replacing the text

Try this out - image 

--

If i've provided something helpful, please upvote the comment. If i've provided a solution, please mark it as 'Best Answer'. This marks the post as answered and helps the community find the solution. If I didn't provide a solution, please let me know if I can help further. Thanks! 🙂


Almost but my number string isn't always the same length. I'm looking to add a decimal in front of the last two numbers regardless of the string length.


Almost but my number string isn't always the same length. I'm looking to add a decimal in front of the last two numbers regardless of the string length.

This should work for you. image.png--

If i've provided something helpful, please upvote the comment. If i've provided a solution, please mark it as 'Best Answer'. This marks the post as answered and helps the community find the solution. If I didn't provide a solution, please let me know if I can help further. Thanks! 🙂


Thank you. This did the trick.

(\\d.{1})$

Replacement text: .\\1


Reply