LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure with range of string characters ("A".."Z") doesn't include last character in the range

Solved!
Go to solution

Is this a bug?

 

Case Structure.png

 

Intention: filter the string character based on whether or not its an 'alphabet' character.

 

Approach 1 (Loop 1): Using case structure with string characters as range ("A".."Z", "a".."z")

Issue: last characters in the specified range ("A".."Z", "a".."z"), which is "Z" and "z" are not included.

 

Solution 1 (Loop 2): Include next character in series so that required character is no longer the last character. Instead of "A".."Z" make is "A".."[" and instead of "a".."z" make it "a".."{"

 

Solution 2 (Loop 3): Include the last character ("Z" or "z") again.

 

The default case (in all case structures) contains a FALSE constant.

Lower two loops give me intended result (filter all characters other than alphabets).

0 Kudos
Message 1 of 4
(3,177 Views)
Solution
Accepted by topic author scofield

No, that's the correct behavior for strings. The Help file for case structures links to this:

 

https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/case_selector_values/

 

Numeric ranges are inclusive, but string ranges are not.

Try using Match Pattern instead:

match.png

Message 2 of 4
(3,161 Views)
Solution
Accepted by topic author scofield

A good tool here is lexical class. (Make a case for 4&5)

 

Some examples:

 

altenbach_0-1591724971363.png

 

 

altenbach_0-1591725552340.png

 

 

 

 

altenbach_0-1591724764450.png

 

Message 3 of 4
(3,128 Views)

We discuss the issue of string case structure ranges in my nugget post on string case structures.

Message 4 of 4
(3,106 Views)