Skip to main content
Question

Add zero in front of some numbers

  • October 30, 2013
  • 4 replies
  • 483 views

Forum|alt.badge.img
Hello

 

 

I have an attribute containting numbers from 1-99 and I would like to add zero in front of the numbers 1-9.

 

 

example:

 

1 -> 01

 

2 -> 02

 

3 -> 03

 

etc.

 

 

Is there an easy way to do this in FME?

 

 

Regards,

 

Stig
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

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • October 30, 2013
Hi,

 

 

There are several way to do that, the easiest will be to add a prefix with the StringPadder, also the StringPairReplacer or the StringReplacer can do the job.

 

 

Itay

takashi
Celebrity
  • October 30, 2013
Hi Stig,

 

 

Yes, there are several ways. The StringFormatter could be also a quick way.

 

 

Takashi

Hi,

 

 

I used StringFormatter and in Format String Attribute I put 02d.

 

 

In my test case that worked well. I hope that is correct.

 

 

Best regards,

 

Stefan

Forum|alt.badge.img
  • Author
  • October 30, 2013
It seems that Stringpadder with prefix 0 and lenght 2 is working perfectly.

 

 

Thanks a lot for all the answers!

 

 

Stig