|
|
switch/case with wildcards?
I know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case statement will execute. Is there a way to use wildcards in the case_expr? Maybe something like {'th*'} would execute for the above (though that doesn't work), and would add 'through' and 'them' and 'thanythingelseyouwant' to the execution list.
|
|
0
|
|
|
|
Reply
|
Mike
|
3/21/2011 7:21:05 PM |
|
"Mike" wrote in message <im88f1$jrm$1@fred.mathworks.com>...
> I know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case statement will execute. Is there a way to use wildcards in the case_expr? Maybe something like {'th*'} would execute for the above (though that doesn't work), and would add 'through' and 'them' and 'thanythingelseyouwant' to the execution list.
% Not that I know of, however you could do something like:
method = 'thanythingelseyouwant'; % Just as an example
switch lower(method(1:2))
case 'th'
disp('Method is th*')
case 't'
disp('Method is t')
case 'an'
disp('Method is an')
otherwise
disp('Unknown method.')
end
|
|
0
|
|
|
|
Reply
|
someone
|
3/21/2011 7:35:05 PM
|
|
|
1 Replies
426 Views
(page loaded in 0.006 seconds)
Similiar Articles: switch/case with wildcards? - comp.soft-sys.matlabI know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case statement will execute. Is there... Switch + Case - comp.lang.asm.x86switch/case with wildcards? - comp.soft-sys.matlab I know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case ... Wildcard match? - comp.unix.shellswitch/case with wildcards? - comp.soft-sys.matlab I know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case ... TCP Fusion tcp_fusion_rcv_unread_min default value - comp.unix ...switch/case with wildcards? - comp.soft-sys.matlab I know switch/case can use multiple case_expr values, e.g ... Multiple default routes (wildcards) is a special case ... GAWK: A fix for "missing file is a fatal error" - comp.lang.awk ...... 0}' prefix*.ext > > Oops, makes not much sense with wildcards. In that case ... You have my blessings. > > > In this particular case, I think a command line switch to ... add a 2nd gateway on a host - comp.unix.solarisMultiple default routes (wildcards) is a special case, they will be used in a round-robin ... ve always If these two systems are attached to the same L2 switch and the ... DOS to WIN32 Redirector - comp.os.msdos.programmer... Xopen_file (TCP_structs.TCP_data tcp_rx)// No wildcards ... switch (tcp_rx.SDA.spop_mode & (MODE_RD_ONLY | MODE_RD ... Read-Only case MODE_WR ... goto in expect scripts - comp.lang.tclThere is [break] and [continue] and [error] and [switch ... to match "$" in expect, instead of using it as a wildcard ... ... whether malloc has allocated memory properly in case ... How to separate command line args - comp.lang.rexx... Now handle switches, longer switch strings must come ... Lueck Lueck Data Systems Remove the upper case ... easy for you to pass the arguments using a glob (wildcard ... switch/case with wildcards? - comp.soft-sys.matlab | Computer GroupI know switch/case can use multiple case_expr values, e.g., {'this','that'} and that if any of them match, that case statement will execute. Is there... Switch Case statement - JavaScript forum - developer FusionHi All, I dont know if this is possible but what I want to do is use a Switch Case statement with wildcards. There are basically too many ... 7/23/2012 7:26:28 PM
|
|
|
|
|
|
|
|
|