LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format String

I need to now what i should put in the format field when converting a number to a string if I want all numbers to display with a width of 3. example: 1 should be displayed 001, 10 should display 010 and 100 should display 100. All the numbers to be displayed are integers.
0 Kudos
Message 1 of 7
(2,847 Views)
http://forums.ni.com/ni/board/message?board.id=170&message.id=126187&query.id=8532#M126187

Message Edited by NahoY on 06-27-2005 10:54 AM

0 Kudos
Message 2 of 7
(2,835 Views)
Hi Phil,

Please see attached 🙂

Regards,
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 3 of 7
(2,824 Views)
%03d

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 7
(2,821 Views)
Thanks to all. Also how can I convert a string or number into a hexadecimal unsigned byte integer(U8)?
0 Kudos
Message 5 of 7
(2,805 Views)
Just use the "Hexadecimal String To Number" or "Number To Hexadecimal String" function, then use the "To Unsigned Byte Integer" to convert to U8. You may want to wire a U8 value to the Default input on the "String to Num", so extra conversions need not be done.

For converting a number, if you want to do it programatically, I think you could just use a property node, but otherwise, just right click on the control/indicator/constant and go to Representation->Unsigned Byte Integer.

If converting to hex is the issue, wire a format string of %x to the Format field of the control/indicator's property node.

Geoff

Message Edited by Novatron on 06-27-2005 02:34 PM

0 Kudos
Message 6 of 7
(2,799 Views)

@PhilGil wrote:
Thanks to all. Also how can I convert a string or number into a hexadecimal unsigned byte integer(U8)?


There is no such thing as a "hexadecimal unsigned byte integer(U8)" U8 is just an internal representation that can be formatted for display in any way you want, e.g. hexadecimal, binary, decimal, etc. by selecting the proper formatting in the indicator.

How is your original string formatted? Is that in hexadecimal (ASCII digits 0-9, A-F)?

Use "scan from string" and wire a default U8 diagram constant to the "default" terminal. The formatting specified depends on how the string is formatted. You can also use any of the "... string to number" functions in the same way.

Message Edited by altenbach on 06-27-2005 11:49 AM

0 Kudos
Message 7 of 7
(2,788 Views)