LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

format decimal into string of 3 characters

Solved!
Go to solution

I have been playing around with "Format Into String" function but haven't been able to exactly achieve this. I have a decimal number which might have any number of significant digits. I want to convert it to a string which will have maximum of 3 characters.

 

If the decimal number is 34.5343, it should give 34.5

If the decimal number is 34.0, it should give 34 (remove the unnecessary 0 after the decimal)

If the decimal number is 128.000, it should give 128 (remove the unnecessary 0 after the decimal)

 

 

Thanks

0 Kudos
Message 1 of 4
(2,720 Views)
Solution
Accepted by topic author abdel2

Hi abdel2,

 

try "%#_3f" as format string...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,717 Views)
Perfect, thank you!
0 Kudos
Message 3 of 4
(2,709 Views)

Hi abdel2,

 

and the best is: I found all the information I needed in less than 2mins by reading the context help...

 

Why didn't you find it? (right-click ScanFromString, select "Help", then select "format string" to get a table of all supported format string options...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,682 Views)