问题描述
我在for循环中有两个变量,如下所示
$ resourcename,$ SearchTextBox
例如,如果$ SearchTextBox是Abhishek而$ resourcename是Abhishek Srivastava
我使用like运算符来匹配字符串中的字符串,如下所示
if($ resourcename,$ SearchTextBox -like" *" + $ SearchTextBox +" *")
它返回true但不幸的是,即使$ SearchTextBox是Abhi然后它也回归真实
如果我犯了任何错误,请告诉我。
问候,
Sudheer
谢谢和问候,Sudheer
中的那个字符串,则like运算符返回true
Hi,
I have two variables in the for loop as below
$resourcename,$SearchTextBox
For example if $SearchTextBox is Abhishek and $resourcename is Abhishek Srivastava
I am using like operator to match string inside string as below
if($resourcename,$SearchTextBox -like "*"+$SearchTextBox+"*")
Its returning true but unfortunately even if $SearchTextBox is Abhi then also it is returning true
Please let me know if I am making any mistake.
Regards,
Sudheer
Thanks & Regards, Sudheer
这篇关于喜欢使用Powershell不能按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!