简体   繁体   English

“ if var in”和“ if var contains”有什么区别?

[英]What's the difference between `if var in` and `if var contains`?

The AutoHotkey documentation lists two methods of comparing a variable to items in a list. AutoHotkey文档列出了两种将变量与列表中的项目进行比较的方法。

if Var in MatchList 如果匹配列表中的 Var
if Var contains MatchList 如果Var包含MatchList

What's the difference between if var in and if var contains ? if var inif var contains之间if var in什么区别?

Hopefully some examples will help demonstrate the difference. 希望有一些例子可以证明这一区别。

Example of if var in MatchList : if var in MatchListif var in MatchList示例:

Match: 比赛:

F3::
example := "pizza" ; Contains a matching string.
if example in This,is,a,tasty,pizza
    MsgBox, %example% found in MatchList

Negative match: 负匹配:

F3::
example := "pizz" ; Contains no matching string.
if example not in This,is,a,tasty,pizza
    MsgBox, %example% not found in MatchList

Example of if var contains MatchList : if var contains MatchList示例:

Match: 比赛:

F3::
example := "ice" ; Contains a matching "i" substring.
if example contains p,i,z,z,a
    MsgBox, %example% contains MatchList item(s)

Negative match: 负匹配:

F3::
example := "doggy" ; Contains no matching substring.
if example not contains p,i,z,z,a
    MsgBox, %example% does not contain MatchList item(s)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript:typeof(var)===&#39;undefined&#39; 与 ==&#39;undefined&#39; 之间的区别? - JavaScript: difference between typeof(var)==='undefined' vs =='undefined'? &lt;=&gt;和-的sort方法块之间有什么区别? - What's the difference between <=> and - in a block for sort method? equal?、eql?、=== 和 == 之间有什么区别? - What's the difference between equal?, eql?, ===, and ==? “包装”和“模块”之间有什么区别? - What's the difference between “package” and “module”? ScalaTest和Scala Specs单元测试框架之间有什么区别? - What’s the difference between ScalaTest and Scala Specs unit test frameworks? google 的 ImmutableList 和 Collections.unmodifiableList() 有什么区别? - What is the difference between google's ImmutableList and Collections.unmodifiableList ()? (typeof variable ===&#39;boolean&#39;)和(typeof variable ==&#39;boolean&#39;)之间有什么区别? - What's the difference between (typeof variable === 'boolean') and (typeof variable == 'boolean')? Visual Studio 2008 Standard和Professional之间有什么区别? - What's the difference between Visual Studio 2008 Standard and Professional? PHP if($ some_var == 1)总是返回true,即使它不是真的吗? - PHP if ( $some_var == 1 ) always returns true even if it's not true? Groovy中==〜和!=有什么区别? - What is the difference between ==~ and != in Groovy?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM