Forum Discussion
boneyard
MVP
Apr 25, 2012looking for nicer way to have variable in the middle of string
i want to create a string where the variable part is in the middle, iRule / TCL doesn't totally get this.
the line below causes the system to assume the variable is $variable_fixedpart2, not just $variable
set name "fixedpart1_$variable_fixedpart2"
this works:
set name "fixedpart1_$variable"
append name "_fixedpart2"
but is there a nicer way, in one line for example?
2 Replies
- hoolio
Cirrostratus
Sure, you can use curly braces to escape the variable name:
set name "fixedpart1_${variable}_fixedpart2"
Aaron - thanks, works as a charm.
i have to get used to curly braces for things like this, im using to using dots and "" for such things.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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