LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting numbers containing coma's

How do I convert a string representation of a number that contains a Zero?

 

For Example:  8,148.23  

 

In this example the conversion using the floating point converter returns 8 instead of 8,148.23 

 

 

0 Kudos
Message 1 of 11
(3,745 Views)

Hi emw,

 

remove the comma using string functions before you convert it to a DBL:

check.png

Best regards,
GerdW


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

When I'm in a coma, I find it exceedingly difficult to convert numbers, even if they contain commas ...

 

BS

Message 3 of 11
(3,691 Views)

Bob_Schor a écrit :

When I'm in a coma, I find it exceedingly difficult to convert numbers, even if they contain commas ...

 

BS


New LabVIEW proverb?

0 Kudos
Message 4 of 11
(3,686 Views)

Ok, now how do I control the Format of a number so that it does contain commas?

 

For example I want to make 186282.396 to read 186,282.396 instead...

0 Kudos
Message 5 of 11
(3,078 Views)

@emw129 wrote:

Ok, now how do I control the Format of a number so that it does contain commas?

 

For example I want to make 186282.396 to read 186,282.396 instead...


You added to a 20 month old tread with a vague question. What do you mean by "read"? (Read from file? display in an indicator? Write to a file or table?)

 

There is no format statement to deal with "thousands" commas, but the math is trivial to translate any floating point number to such a string. Have you tried?

 

(Sorry, posting by phone)

0 Kudos
Message 6 of 11
(3,068 Views)

i remember some time back that LabView had some kind of %###,###.###f format type that would insert comma's for powers of a thousand, but I can't remember the exact format of that format control.

0 Kudos
Message 7 of 11
(3,000 Views)

Hi emw,

 

i remember some time back that LabView had some kind of %###,###.###f format type

I don't think so.

Maybe your memory is mixed with Excel stuff?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(2,997 Views)

How do I output Comma Delimited Formatted numbers (IE:  186,282.396) [American English Standard]

 

Which format control string provides that?  And this can vary between American English standards and European Standards where their comma's and decimal points are swapped characters.  They use periods for comma's and comma's for periods.

0 Kudos
Message 9 of 11
(2,995 Views)

There is nothing built into LabVIEW to do it.  Someone may have created their own subVI.  I think I saw one time a Regex that will do that.

 

You should add a Kudo to this idea.  https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Visual-Aides-Numeric-Separators/idi-p/941273

0 Kudos
Message 10 of 11
(2,983 Views)