Forum Discussion
mraful_64014
Nimbostratus
Feb 12, 2015reverse a string or list
The iRules TCL implementation does not have a string reverse or list lreverse function. Any ideas on how I could accomplish that? I'm capturing a DNS PTR query and reversing the result of the DNS::q...
StephanManthey
Nacreous
Feb 12, 2015or a slightly more generic approach in case you don´t have a fixed number of digits and want to use list functions:
set ip_addr [IP::client_addr]
set separator "."
for { set digit [expr {[llength [split $ip_addr $separator]] -1 }] } { $digit >= 0 } { incr digit -1 } {
lappend reverse_order [lindex [split $ip_addr $separator] $digit]
}
set reverse_ip [join $reverse_order $separator]
But for sure Brad´s solution is way faster. +1 🙂
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