This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

comparing/matching word <-> list

Old posts that have not been replied to for several years.
Locked
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

comparing/matching word <-> list

Post by BiLL »

Blee!!!

Since one hour I am trying to find the correct if clause, I searched through the forum but didn't find a good solution.

My problem:

set name "BiLL"
set namelist "Martin Niklas BiLL Rudolf Dieter"

I want to look if $name is in $namelist (string tolower/-nocase prefered), but it always doesn't jump into my putserv. I tried a fewer other ways like string match ==, string compare ==, etc. but nothing worked. Anyone may help me?

if {[lsearch [string tolower *$name*] "[split $namelist]"] != -1} {
putserv "PRIVMSG $chan :Already in namelist!
return 0
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

try *[string tolower $name]* instead and you probably should make the $namelist in lower-case too.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

lsearch syntax is: lsearch ?options? list pattern
Elen sila lúmenn' omentielvo
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

Post by BiLL »

thx got it :)
Locked