I have a table $t (an imported csv) with several columns. The first header is 'A'. I want to know the number (index) of the row where the value in column 'A' equals the searchstring $s (without using a loop).
So I found [array]::indexOf(<1-dimensional-array>,<searchString>)
In order to use this, I need to create a 1-dimensional array from column 'A'.
I tried $a = @($t | select A)
and then I can address each element like $a[0]
or $a[3]
. So does this qualify as an one-dimensional-array in the context of indexOf?
When I set the search string $s to a value that is present, then
[array]::indexOf($a,$s)
always returns -1.