Forum Discussion
LTM
I will illustrate with an example. Considering just this code:
1: set counter [llength [split $parser "_"]]
2: set appporttype [getfield $parser "_" $counter]
3: regsub $appporttype$ $parser "" parser1
4: regsub {_$} $parser1 "" parser
I added line number for clarity. Assume that, right before this code executes, $parser is "PRIV_ABC_DEF_001".
After line 1, $counter will contain the value 4. That's because it treats the value in $parser to be a set of fields separated by underscores. Thus, there are four fields, namely the set ("PRIV", "ABC", "DEF", "001").
After line 2, $appporttype will equal "001" because it is the last label in $parser, again, treating it as a string of fields delimited by underscores.
After line 3, $parser1 will be "PRIV_ABC_DEF_", because it is the value of $parser with the last field removed.
After line 4, $parser will be "PRIV_ABC_DEF", because it strips the trailing underscore from $parser1 and assigns the result back to $parser.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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