LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the search 1D array function case insensitive for string array

Solved!
Go to solution
How to make the search 1D array function case insensitive for string array
0 Kudos
Message 1 of 13
(5,497 Views)
Solution
Accepted by topic author Flamboyant

Hi cooldude,

 

convert both (array and search string) to lowercase before using this function...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(5,482 Views)

Why are you using Search Array-Functions for strings when there are several Search String-Functions?

And can you please explain it a bit more in detail?

Message 3 of 13
(5,481 Views)

Christian_M wrote:

Why are you using Search Array-Functions for strings when there are several Search String-Functions?

And can you please explain it a bit more in detail?


 

Agreed. For example Match Regular Expression has an input for ignore case.
Richard






Message 4 of 13
(5,475 Views)

Christian_M wrote:

Why are you using Search Array-Functions for strings when there are several Search String-Functions?


 

Well, the user did say they have a string array, so....

 

Of course, they could use the Array to Spreadsheet String so then they could use the string search functions, but that would embed undesired characters in the string since the Array to Spreadsheet String does not accept an empty string as a delimiter. 

0 Kudos
Message 5 of 13
(5,460 Views)

smercurio_fc wrote:

Christian_M wrote:

Why are you using Search Array-Functions for strings when there are several Search String-Functions?


 

Well, the user did say they have a string array, so....

 

Of course, they could use the Array to Spreadsheet String so then they could use the string search functions, but that would embed undesired characters in the string since the Array to Spreadsheet String does not accept an empty string as a delimiter. 


I assumed the user would throw the function into a for loop. For that matter, you still have to use a for loop with "Search 1D Array" if you want to return all elements found (or use OpenG's Search Array which functions like a "Search Array Until Done").

Message Edited by Broken Arrow on 12-01-2009 09:31 AM
Richard






0 Kudos
Message 6 of 13
(5,451 Views)
In my post above, I should of said while loop where I said for loop. (for loop would work but while loop would be more conventional).
Richard






0 Kudos
Message 7 of 13
(5,441 Views)

smercurio_fc wrote:

Of course, they could use the Array to Spreadsheet String so then they could use the string search functions, but that would embed undesired characters in the string since the Array to Spreadsheet String does not accept an empty string as a delimiter. 


Well, a substitute for the nonexistent "delimiter-free array to spreadsheet string" is a simple "concatenate strings" of size=1. Try it!

Still, since strings are variable lenght, we would lose all information on index position, so this method would only partially work for simple questions such as "s there a match". It can also give false positives, e.g. if the search string matched the tail of one string concatenated with the head of the next element.

 

If all the OP is looking for is a case insensitive match of an entire array element, I would go with Gerd's suggestion above.

 

0 Kudos
Message 8 of 13
(5,431 Views)

altenbach wrote:

smercurio_fc wrote:

Of course, they could use the Array to Spreadsheet String so then they could use the string search functions, but that would embed undesired characters in the string since the Array to Spreadsheet String does not accept an empty string as a delimiter. 


Well, a substitute for the nonexistent "delimiter-free array to spreadsheet string" is a simple "concatenate strings" of size=1. Try it!


Yeah, I know about this. I was just making a point about the fact that the source is an array, and not a string.

 

And I was taking a pot-shot at NI over that function. Smiley Very Happy

0 Kudos
Message 9 of 13
(5,428 Views)

smercurio_fc wrote:

And I was taking a pot-shot at NI over that function. Smiley Very Happy


Me too! 😄

0 Kudos
Message 10 of 13
(5,424 Views)