05-03-2021 05:32 PM
This:
Yields 3 strings: "ABC", "DEF", "GHI".
Whereas this:
Yields 3 strings: "ABC", "GHI", "", and an error. WHY? (Oh I know there's a reason, just not a good one).
Of course there are lots of ways to parse out the string so the double new-line would yield a null string in the middle, but is there a trick to get Scan From String to do it nicely?
Solved! Go to Solution.
05-03-2021 06:49 PM - edited 05-03-2021 06:52 PM
I'm guessing it has to do with how LabVIEW treats "whitespace". Looking into the "trim whitespace.vi" it uses regex to look for tabs, space, carriage return and newlines AND any number of them. Two newlines are probably treated as a single entry of "whitespace".
You've probably figured a way around, but here's one that specifically looks for each newline character and splits the string by that.
05-04-2021 02:42 AM
@paul_cardinale wrote:
This:
Yields 3 strings: "ABC", "DEF", "GHI".
Whereas this:
Yields 3 strings: "ABC", "GHI", "", and an error. WHY? (Oh I know there's a reason, just not a good one).
Of course there are lots of ways to parse out the string so the double new-line would yield a null string in the middle, but is there a trick to get Scan From String to do it nicely?
I think this might have actually worked in LV 2012.
05-04-2021 06:25 AM
This works, it's just a lot messier than Scan From String would be:
05-04-2021 11:11 PM
A regex with submatches also works:
05-05-2021 03:15 AM
@paul_cardinale wrote:
but is there a trick to get Scan From String to do it nicely?
05-05-2021 07:08 AM
wiebe@CARYA wrote:
@paul_cardinale wrote:
but is there a trick to get Scan From String to do it nicely?
Doesn't handle blank lines.