06-12-2019 11:17 AM
Hi, I have to parse the letters out of a string to just get the numbers. I have four cases (just using filler numbers for this), so I have-
Vbatt: 0.15V
Ichgin: 0.15A
Ichgin: 0.15A
Ibatt: 0.15A
and I want just 0.15 as an output string. How do I approach this for all different cases?
Thanks in advance
06-12-2019 11:20 AM
For each line, parse the substring after ":"
06-12-2019 11:52 AM
You can do it with a single Scan from String. Read the Detailed Help for this function (drop the function on the Block Diagram, select it, and choose Help).
Bob Schor
06-12-2019 11:59 AM
It wasn't clear if "I have four cases" means that each scan is one of the four or if we get the entire four-line string at once, differing only in the numerics between successive scans.
06-12-2019 04:53 PM
The following regular expression would work:
([\d\.]+)
If you want to also extract the units, you could use the expression:
([\d\.]+)(\w)
06-12-2019 05:12 PM
@Bob_Schor wrote:
You can do it with a single Scan from String.
Here's probably what Bob had in mind: