-contains operator vs .contains() method

I am the first person to scream RTFM or some equivalent to use search engines, but I hope the community will forgive me as I am neck deep in a project and confused about something

Would someone please give me a brief explanation as to why the -contains operator returns a different result as the .Contains method call does (as in the following example)?

PS C:\Windows\system32> $string = "abcdefg"

PS C:\Windows\system32> $sting -contains "abc"
False

PS C:\Windows\system32> $string.Contains("abc")
True
It is not immediately clear to me why these would return different results.  I know I am missing something simple and thank in advance anyone helpers.



  • Edited by RKS333 Wednesday, July 22, 2015 3:16 AM
July 22nd, 2015 3:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics