05-23-2011 10:49 AM
No Lynn,
My strings consist with printable characters only.
A bit of explanation why I do need more clever comparison function.
The strings I'm comparing are commands I send to the subsystem. I'm comparing the strings/commands against the dictionary for the syntax correctness. To do that my colleague converted everything to the upper-case and then he did comparison. He took the converted strings and since this moment rest of the system works using these upper-case style strings/commands.
The syntax is correct. But toghether with the syntax the rest of the string got converted as well. It was not the problem untill one with the measurement devices we use makes the distinction between upper an lower cases. The keyword "POWER' is not recognised because for the device words 'POWER' and "Power' are completly different.
For my case the best would be to relax the comparasion policy to 'a' = 'A' level. But unfortunatelly there is no this quite straighforward option in LabVIEW.
05-23-2011 10:56 AM
If POWER and Power mean different things for your device, then you don't want a case insensitive comparison. You want to know that the two are different. So I don't really understand what you are asking for here.
05-23-2011 11:11 AM
Ravens Fan,
There is a bit of history behind.
Before I send the command to the device the command syntax is checked. This operation is based on string comparasion. To do the comparison the string is converted to the upper case. It is only one reason why the string is converted. To make the comparision in LV.
Converted in this matter string is upper-case. Toghether with all its elements.
And because the crucial keyword is converted as well (it's not demanded, side effect from the syntax check operation) it
makes problems for me.
If I could have case insensitive comparison operator I wouldn't need to do uppercase conversion and the same my caps lock sensitive keyword would be saved.
That's why.
05-23-2011 11:37 AM
DO not change the string that is passed only check the upper case and then pass the orginal command. You can use what I gave you and see if it is the same then pass the orgianl command if it is.
05-23-2011 11:50 AM
Yes, I thought about this.
The whole project is big enough to to that.
The case insesitive coprarison would be great for it.
05-23-2011 12:01 PM
You can do it this way and you get waht you want. If you get a match then you just pass on the matched value and you do not have to worry about case
05-23-2011 12:42 PM
It seems to me you have a two part string, a command and some parameters. You want to check the command ignoring case but leave the case alone for the remainder of the string. I (surprise, surprise) would use a variant in this case such as the following snippet:
On the first call, I build a dictionary using the list of commands in the Commands array. The variant attribute name is changed to all caps while the value is the original string from the Array. Next, the Command is extracted from the string, I assume that space is the separator, change as needed. This command string is converted to All Caps to search the attribute names for a match. If found, the properly capitalized version is returned (ie. POwer could be changed to Power) and the rest of the string is appended. Commands which do not match are simply passed through as is. The Boolean is used to indicate a valid command.
10-04-2019 03:30 PM
My solution for this is to convert the string to be searched to all lower case and then search that string with lowercase keyword/regex
07-11-2023 07:29 AM
Here is my solution for the problem. I'm using arrays and convert all letters to lower case. The matching results are shown as they were before converted to lower case. Hope it helps to someone.
07-11-2023 09:00 AM
@BlackSupra wrote:
1. Why the Index Array inside of the loop? Just use the autoindexed tunnel.
2. If using a newer version (2014?), you can use the conditional indexed output tunnel instead of the shift register, case structure, and build array.
3. Why in Input List using a local variable instead of the terminal?