![](/img/trans.png)
[英]JavaScript: difference between typeof(var)==='undefined' vs =='undefined'?
[英]What's the difference between `if var in` and `if var contains`?
AutoHotkey文檔列出了兩種將變量與列表中的項目進行比較的方法。
如果匹配列表中的 Var
如果Var包含MatchList
if var in
和if var contains
之間if var in
什么區別?
希望有一些例子可以證明這一區別。
if var in MatchList
的if var in MatchList
示例:
比賽:
F3::
example := "pizza" ; Contains a matching string.
if example in This,is,a,tasty,pizza
MsgBox, %example% found in MatchList
負匹配:
F3::
example := "pizz" ; Contains no matching string.
if example not in This,is,a,tasty,pizza
MsgBox, %example% not found in MatchList
if var contains MatchList
示例:
比賽:
F3::
example := "ice" ; Contains a matching "i" substring.
if example contains p,i,z,z,a
MsgBox, %example% contains MatchList item(s)
負匹配:
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.