LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How extract numbers from string in labview ?

Solved!
Go to solution

Hi, I want to get from 2023_04_15_12_12.rar this string 202304151212.

0 Kudos
Message 1 of 7
(1,559 Views)
Solution
Accepted by topic author Petros_Baghalyan

@Petros_Baghalyan wrote:

Hi, I want to get from 2023_04_15_12_12.rar this string 202304151212.


Scan from String with format specifier "%d_%d_%d_%d_%d" and then format the element back into a string with Format into String and "%d%d%d%d%d".

 

Alternatively you can also use the Search and Replace String with search pattern set to "_" and the replace string set to "" (empty string).

Rolf Kalbermatter
My Blog
Message 2 of 7
(1,546 Views)

i want to know how many days difference between today and 2023_04_15_10_43 .

0 Kudos
Message 3 of 7
(1,522 Views)

Hi Petros,

 

use ScanFromString to parse into a timestamp - see the help for all the supported format codes.

Then it's a simple subtraction (and division) to get the days of the time span…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(1,514 Views)

Thank you for answered ,can you send sqreen ?

0 Kudos
Message 5 of 7
(1,507 Views)
Solution
Accepted by topic author Petros_Baghalyan

Hi Petros,

 


@Petros04 wrote:

Thank you for answered ,can you send sqreen ?


I could…

 

What have you tried so far?

What don't you understand from the LabVIEW help for ScanFromString?

Have you tried to subtract two timestamps so far?

(Why do you need a 2nd account now?)

 

Spoiler
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(1,504 Views)

Thank you 

0 Kudos
Message 7 of 7
(1,428 Views)