When I use the "match" operator to compare to strings in the following
manner, the comparison is case insensitive:
"hello" -matches "HELLO"
The above evaluates to true. How can I make this comparison case
SENSITIVE?
Thanks in advance,
John
John,
I assume you meant to write '-match' rather than '-matches'. All of
the comparison operators have case sensitive and case insensitive
variants:
PSH$ "hello" -match "HELLO"
True
PSH$ "hello" -cmatch "HELLO"
False
PSH$ "hello" -imatch "HELLO"
True
The match is case insensitive by default, so '-match' is the same as '-
imatch'; '-imatch' is there so code that depends on case insensitivity
can be as clear as possible.
See 'help about_operator' for more information.
Jeff
PS > "hello" -cmatch "HELLO"
False
There is also -imatch for case-insensitive, which is the default behaviour.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic