Forum Discussion
Robert_47833
Nov 14, 2011Altostratus
how to use switch to match datagroup
1:there is a datagroup:cjj
how to use switch to match this group
switch -glob [HTTP::path] {
"cjj" xxxx ???
2:
switch -glob [HTTP::path] { "*jpg" - "*bmp" - ...
hooleylist
Nov 14, 2011Cirrostratus
1: I want to know whether datagroup can be applied in switch syntax
No. A switch statement can't reference a datagroup.
2: I 'd like to know in which case I should use variable
As you're only referencing HTTP::path once there isn't any reason to use a variable. If you were running an operation against a command multiple times you'd want to run it just once and then save the output to a variable. For example, if you were setting a URI to lower case and checking it multiple times, you'd want to save the lower case URI rather than running string tolower multiple times.
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects