Switch Statement with Wildcard Parameter
suggest change-Wildcard compares the value with each condition as a wildcard pattern. * is any run of characters, ? is one character, and [...] is a character set. Every matching condition runs.
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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents