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: 

STRING CONTAINS TWO COMMA TO NUMBER

Solved!
Go to solution

hi guys i have a problem which i get a only 2 numbers after converting string to numberCapture d’écran 2020-01-03 à 00.49.51.pngCapture d’écran 2020-01-03 à 00.50.08.png

0 Kudos
Message 1 of 8
(3,476 Views)

I don't understand how your subject line relates to the image you show.

 

You say the string contains two commas,  but it looks like two periods.  What is "55.16.1" supposed to mean?

 

The Time array shows them with a single comma.

 

Are you in a country that uses a comma as a decimal point?  If so, read the detailed help of that function carefully.  You might be better off using Scan From String which has more control in the format string on how to handle unusual decimal point requirements.

0 Kudos
Message 2 of 8
(3,452 Views)

"55.16.1" its mean experience number 55 and 16,1 means time the probleme i can reached to second part, i just want to separate 55 and 16,1 ,sory for my bad englich

0 Kudos
Message 3 of 8
(3,444 Views)
Solution
Accepted by AYM8NE

If the problem is converting the string "12.34.56" into the number 34.56 then I'd suggest splitting your string at the first "." then converting the second part of the string.

 

There are numerous search functions that might be useful if you wished to do this in two steps, together with String Subset.

 

To do this in a single string operation and then the conversion, you could use something like a Regular Expression match and the submatch system.

Example_VI.png


GCentral
0 Kudos
Message 4 of 8
(3,426 Views)

You definitely should use the Scan From String.  You could use "%.;%d.%f" for your format string to get your two values.


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 5 of 8
(3,424 Views)

@AYM8NE wrote:

"55.16.1" its mean experience number 55 and 16,1 means time the probleme i can reached to second part, i just want to separate 55 and 16,1 ,sory for my bad englich


Even what you say here doesn't match what you have.  "16.1" is in your string and you say it is "16,1".  Be consistent in your description as to whether you have commas or periods!

 

What generated this string?  Do you have control over it?  If you want to separte 55 from 16.1, whatever created it should have been outputting 55,16.1  So that you have a comma to separate the values (otherwise know as CSV, comma separated value), and a decimal point used in 16.1.

0 Kudos
Message 6 of 8
(3,415 Views)

THANKS A LOT THATS WORK FOR MY SITUATION 

0 Kudos
Message 7 of 8
(3,409 Views)

Check your CAPS LOCK key.  It seems to be stuck on.

0 Kudos
Message 8 of 8
(3,398 Views)