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.

no case sensitive in tcl

Old posts that have not been replied to for several years.
Locked
Y
Yoda
Halfop
Posts: 78
Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:

no case sensitive in tcl

Post by Yoda »

hi,
I have a very stupid problem but I dont know how resolve it :lol:

Code: Select all

if {$nick == "Yoda"} 
in this way bot detect only if the nick is Yoda, but how get that bot detect not case sensitive?

I tried with != and works as non sensitive but bot continue to repete the message asked by procedure. what instead of == ?

thanks for help

Yoda
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is a basic form of matching, also known as explicit matching.

There are several ways to use non-explicit and explicit matching, in a non-case sensitive way.

Some inlclude converting both the matching text, and the incoming text to lower case.

Others involved non-case sensitive commands.

Here are a few.

Code: Select all


set a "Hello"
set b "heLLo"

# Exlicit
if {$a == $b} {}

# Non-sensitive
if {[string tolower $a] == [string tolower $b]} {}
if {[string equal -nocase $a $b]} {}
Y
Yoda
Halfop
Posts: 78
Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:

Post by Yoda »

thanks for rush answer. my problem:

Code: Select all

if {$nick == "yoda"} {
			putmsg $chan "4,0 Yoda wecome"
		}
I would like to join with Yoda, yoda, YOda, YODa, YODA and the script detect me. with the script above I am detected only if I join with yoda, if I join with Yoda nothing happen. can you say me what I have exatly to add? :D

Yoda
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Use string tolower or strlwr (wich is the same thing but with a shorter name) then. eg:

Code: Select all

if {[strlwr $nick] == "yoda"} {
bla
}
You should pay more attention to what ppslim sugested you before me.
Once the game is over, the king and the pawn go back in the same box.
Y
Yoda
Halfop
Posts: 78
Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:

Post by Yoda »

thanks alot and sorry, now I have understood. I am not much practical one with tcl.

Yoda
Locked