Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

i have a irules question

hi:irules{ set a [getfield [HTTP::header Location] "9480" 2]}

I want to change 9480 to 4 integer variables

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi,

Is the first part static?

Or is there a static string just before this integer?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

You can use spilt to split a variable into a list of it's constituent parts. Then use lindex to return the value of that list element

set a [split {9480} {}]
set a1 [lindex $1 0]
set a2 [lindex $1 1]
set a3 [lindex $1 2]
set a4 [lindex $1 3]

https://wiki.tcl-lang.org/page/split

If you don't know how many elements to expect in the list you can consider using llength and iterating through the list in a loop

0