Skip to main content
Question

Add zero in front of some numbers

  • October 30, 2013
  • 4 replies
  • 414 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

4 replies

fmelizard
Safer
Forum|alt.badge.img+18
  • 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
Influencer
  • 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

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