使用萬用字元引數 switch 語句

-Wildcard 引數允許 switch 語句對條件執行萬用字元匹配。

例:

switch -Wildcard ('Condition')
{ 
    'Condition'           {'Normal match'}
    'Condit*'             {'Zero or more wildcard chars.'} 
    'C[aoc]ndit[f-l]on'   {'Range and set of chars.'}  
    'C?ndition'           {'Single char. wildcard'}
    'Test*'               {'No match'} 
}

輸出:

Normal match
Zero or more wildcard chars.
Range and set of chars.
Single char. wildcard