Can't seem to get the IndexOf overload to work to support case insensitive lookups. Can you help me understand what I'm doing incorrect?
$a = 'a','b','c' $a.IndexOf('B',[System.StringComparison]::CurrentCultureIgnoreCase)
I receive this error...
Cannot find an overload for "IndexOf" and the argument count: "2".
At line:1 char:1
+ $a.IndexOf('B',[System.StringComparison]::CurrentCultureIgnoreCase)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
The Get-Member shows that there is an overload to adjust the comparisonType
($a | Get-Member -Name IndexOf).Definition
int IndexOf(char value), int IndexOf(char value, int startIndex), int IndexOf(char value, int startIndex, int count), int IndexOf(string value), int IndexOf(string value, int startIndex), int IndexOf(string value, int startIndex, int count), int IndexOf(string
value, System.StringComparison comparisonType), int IndexOf(string value, int startIndex, System.StringComparison comparisonType), int IndexOf(string value, int startIndex, int count, System.StringComparison comparisonType)
PSVersion 5.0.10586.494