Forum Discussion
Barry_Gavenda
Nimbostratus
Jun 24, 2019Variable in a string map
We are using a string map where we are replacing the value found with a variable. Sounds nice, but we can't get it to work. F5 just sends it the $variable (literally). Tried brackets, quotes, everything. Ideas on how to do this?
set variable = "xxxx"
set newpoolname [string map -nocase {"-app" $variable} $defaultpool]
result is -app is replaced with $variable (not xxx).
- Stanislas_Piro2
Cumulonimbus
String map expect a list as argument...
you can create a list with following format:
>set variable = "xxxx" # curly brackets doesn’t support variables set newpoolname [string map -nocase {"-app" $variable} $defaultpool] # list command between brackets with even parameter numbers is the best solution set newpoolname [string map -nocase [list "-app" $variable] $defaultpool] # create a string with space... it will be converted to a list with space as separator (less efficient than list and curly brackets) set newpoolname [string map -nocase "-app $variable" $defaultpool]
- Barry_Gavenda
Nimbostratus
Thank you!!!
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