06-01-2009 09:55 AM
Hi all,
I am saving .txt files by the order they occur, ie. 1.txt, 2.txt,.... etc. but i need 3 zeros to the left so they get saved as 0001.txt , ...., the number itself comes from a recursive file list and i can't seem to convert it properly... I tried number to decimal string using a width of 4 and then I used "format into string" with "%[0] " in the "format string" section which doesn't convert the spaces to zero as it says it should in th format specifier syntax, am i using the wrong VI or is the argument not typed out correctly? ....
Thanks
G
06-01-2009 10:10 AM
gx,
You're on the right track. Try this.
06-01-2009 10:13 AM
06-01-2009 10:55 AM
Worked Perfectly thanks a lot...
Greg
03-19-2012 10:10 AM
Instead of starting a new thread, I thought I would add on to this one. This solution works for decimal numbers, but how do I get it to work for float numbers?
I want to convert "5.3" from a numeric control into string "005.30".
03-19-2012 10:16 AM
hope it helps
03-19-2012 10:16 AM - edited 03-19-2012 10:25 AM
03-19-2012 10:19 AM
@Akiel wrote:
hope it helps
your answer has nothing to do with floating point numbers and makes no sense.
03-19-2012 10:22 AM
it does if you take into account when i started the message this thread was blank, unfortunatly it moved on alot before I posted and hence as you say is irrelevant to what your talking about now.
03-19-2012 10:28 AM
@Akiel wrote:
it does if you take into account when i started the message this thread was blank,...
This thread started in 2009, so I doubt that. 😄
In any case formatting with leading zeroes is a common operation and has full support in the format codes. No need for string operations. 😉