From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert string number to a string with 6 digits

For example. I want to convert a string 6 to 0000006. I used the format specifier %07d. By I am getting 6000000 instead of 0000006 . It would be great if I get a solution for this.

 

Skaria Roy

LabVIEW Enthisiast

0 Kudos
Message 1 of 4
(3,675 Views)

Try this one: %0#7_13g

0 Kudos
Message 2 of 4
(3,669 Views)

I'm assuming you are starting with a string representing an integer, and want a string of 7 digits, padded with (leading) zeros.  The solution is very simple -- Scan from String (to convert the String into an I32) and wire that directly into Format into String with a format of %07d.

 

Bob Schor

0 Kudos
Message 3 of 4
(3,643 Views)

Here are a couple of options for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(3,618 Views)