I'd like to check whether string contains 2 the same chars like "*aa*" "*bb*" and so on.
Code: Select all
if {([string match "*aa*" $string]) || ([string match "*bb*" $string])....... || ([string match"*zz*" $string])}
TIA
Code: Select all
if {([string match "*aa*" $string]) || ([string match "*bb*" $string])....... || ([string match"*zz*" $string])}
Code: Select all
set test "abcdeefg"
set car ""
set last [string index $test 0]
for {set loop 1} {$loop <= [strlen $test] } {incr loop} {
set car [string index $test $loop]
if { $car == last } { then .. }
set last $car
}
Code: Select all
if {[regexp aa|bb|cc|dd|ee|ff|gg|hh|ii|jj|kk|ll|mm|nn|oo|pp|qq|rr|ss|tt|uu|vv|ww|xx|yy|zz $string]} { .... }
set mp3players {
" \*word\*word2\* "
" \*word\*word2\* "
}
bind pubm - "*" mp3
proc mp3 {nick uhost hand chan rest} {
global botnick kick_msg mp3players
regsub -all -- {\002|\037|\026|\017|\003([0-9][0-9]?(,[0-9][0-9]?)?)?|^B|^V|^C([0-9][0-9]?(,[0-9][0-9]?)?)?|^_} $rest "" rest
foreach mp3_line $mp3players {
if {[regexp $mp3_line [string tolower [lindex [split $rest] 0]]]} {
Code: Select all
set mp3players {
" \*word\*word2\* "
" \*word\*word2\* "
}
Code: Select all
set mp3players [list]
lappend mp3players "\*word\*word2\* "
lappend mp3players "\*word3\*word4\* "