LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
w_kt

Behavior when you specify a string range to the case selector label

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

When comparing strings with the case structure, behavior at the time of the range specification is different from that of numeric type.

 

I have set a default case to case the other in the block diagram below.
If the default case, "B" is to be output.

You might think that it outputs the "A" none at first glance, but it will be "B" output of the block diagram of the second.

 

Block diagram

case_structure_string_match.png

 

Output

case_structure_string_match_output.PNG

 

 

This behavior is described in Help. It was also in the old version. It is probably specification.
It may be the reason for a bug if you write a program of string processing without knowing this specification.

 

I think that we should match the case, "c", which wrote "a" .. "c" in the case selector label.

 

 


Link:LabVIEW2013 Help - Entering Values for Each Case Structure Subdiagram

 

Quote:

String ranges
A range of a..c includes all strings beginning with a or b, but not c. String ranges are case sensitive. For example, a range of A..c behaves differently than a..c because LabVIEW uses ASCII values to determine a string range.

 

4 Comments
Darin.K
Trusted Enthusiast

Inclusion of the upper range is natural for chars (ie. single character strings), but not good for actual strings.  Very analogous to ints versus floats.  if a..c included c how would you define all strings which start with a or b but not c? 

 

What needs to happen is that LV needs to recognize the standard [] versus () notation for including the upper limit in ranges.  You could specify [a..c] for your case of single character strings and [a..c) for normal strings.  This change would also allow floats to be wired to case structures, win again.

DJed
NI Employee (retired)
Yes, if this change were made, it would become impossible to express the case [a,c) That is everything starting with an a or a b. If you wish to do everything starting with an a or b or c, do a..d If you wish to do everything starting with an a or b AND exactly the letter c then do a..c, c
w_kt
Member

OK, I understand.

I did not understand that the following first.
If described as "1, 2, 3, 4" in the integer type to become the equivalent to "1 .. 4", but that if the string type that is not the case.
For a comparison of string type, that can also specify ranges, such as, "a" .. "az" but I thought the thing of just watching one character that you specify at the beginning simply whether included .

 

It was found my idea is not so good to understand to try in various ways.

 

thanks,

 

case_structure_test_snipet.png

case_structure_test_FP.PNG

https://decibel.ni.com/content/docs/DOC-32767

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.