Forum Discussion
Kevin_Stewart
Jun 26, 2014Employee
You're probably right from a performance perspective:
!/usr/bin/tclsh
set str "test-tools-config.acme.com"
set timer1 [time {
set foo [string range [regexp -inline {\-[^-.]+\.} $str] 1 end-1]
} 10000]
puts $timer1
set timer2 [time {
set foo [string tolower [lindex [split [lindex [split $str "."] 0] "-"] end-1]]
} 10000]
puts $timer2
On my lab VM the regex is always a bit heavier