LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

floating point no. to string with same precision

Solved!
Go to solution

I'm using 'format into string' to convert floating point no. to string. Most of the the numbers have single digit decimal so i use "%^0.1f" in the format into string terminal. But for whole nos. like 150, it gets converted to 150.0. I want to avoid this, such that the string looks exactly like the no.. What should i change?

0 Kudos
Message 1 of 4
(2,718 Views)

Hi,

 

For whole numbers, use "%d" instead of "%^0.1f".

Certified LabVIEW Developer
0 Kudos
Message 2 of 4
(2,707 Views)
Solution
Accepted by topic author shreya005

Use %#0.1f as your format string.

 

Read the help file on format codes.  The # sign tells it to truncate trailing zeroes.

Message 3 of 4
(2,699 Views)

Thanks a lot. it works perfectly now 🙂

0 Kudos
Message 4 of 4
(2,683 Views)