LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string ranges

Solved!
Go to solution

How can I split a string range into a list or an array

say

1002..1004,1009,1100..1102

to a list like

1002, 1003, 1004, 1009, 1100, 1101 ,1102

or an array

 

0 Kudos
Message 1 of 6
(2,648 Views)

Can you guarantee that the input is well formed (all integers, comma delimited singles, ".." delimited ranges (not "." or "..."), no weird other characters, all one single line, all ranges going from smaller to bigger, etc.

 

In that case, seems easy. What have you tried so far?

0 Kudos
Message 2 of 6
(2,637 Views)
Solution
Accepted by topic author DanlB

Here's one simple possibility (LV2015):

 

expandRanges.png

Message 3 of 6
(2,614 Views)

And to allow ranges in both directions, here's how you would modify the default case.

 

expandRangesupdown.png

Message 4 of 6
(2,605 Views)

I was hoping for a nice clean function.

I made a parser that works but it is definitely not clean

a couple of your parsing ideas simplified my version

thanks

0 Kudos
Message 5 of 6
(2,584 Views)

@DanlB wrote:

I was hoping for a nice clean function.

I made a parser that works but it is definitely not clean

a couple of your parsing ideas simplified my version

thanks


Make it into a subVI.

aputman
0 Kudos
Message 6 of 6
(2,493 Views)