01-15-2015 11:55 PM
Can anyone tell me what's going on with the case structure? It decides "Z" is not in the A..Z range. Works as I expect when I pass it into a "in range and coerce" function.
Found on LV2013-32 running on Win7-64. Confirmed same behaviour in LV2014-32 on same machine.
Solved! Go to Solution.
01-16-2015 12:43 AM
I can confirm this on my LabVIEW 2013 32-bit Full / Win7-64. In the case structure just a simple Z works fine, but anything .. Z fails.
Z .. is OK
01-16-2015 01:38 AM - edited 01-16-2015 01:40 AM
This is not a bug, its a known behaviour according to the LabVIEW help. To verify replace the range with "A".."Z" with "A".."a" and see the difference.
Edit: Case Structure link for your reference
01-16-2015 06:47 AM
This is correct behavior. The strings are not inclusive when it comes to the upper range. I don't remember the exact reasoning. It was somewhere in the Idea Exchange.
01-16-2015 07:06 AM
Hi,
what's going on with the case structure? It decides "Z" is not in the A..Z range.
Well, reading the LabVIEW help would explain the behaviour in each detail.
It says:
A range of a..c includes all strings beginning with a or b, but not c.
01-16-2015 09:43 AM
P@Anand wrote:
[,,,] To verify replace the range with "A".."Z" with "A".."a" and see the difference.
I like "A..Z", "Z" better. It'll avoid ambiguity when a desired range is, say, from C to L, inclusive. "C..L", "L" makes it clear that "M" isn't included.
01-16-2015 10:04 AM
01-16-2015 05:47 PM
Remember that the case structure is based on a string in this case, even if you are thinking in terms of chars.
Let's say that the upper limit was inclusive, then to match strings which start with A,B, and C [A..C] you would have to specify the "largest" string which begins with C, is it CZZZZ or CZZZZZZZZ or C\xFF\xFF\xFF.... etc. The way it is now you can do [A..D)
The same issue complicates adding floats to the case selector options.
One solution is to add the ability to specify the inclusiveness of the boundaries. The normal method is [,] for inclusion and (,) for exclusion. Then you could write [A..D) for strings and [A..C] for chars. And you could add floats to the Case structure as well.
Another is to allow U8's to be viewed as their ascii equivalent so you could use those more readily. Same as selecting the radix.
Another option is to have an option to match only the first char of the string and make the limit inclusive in that specific case.