Version 2 of string equal

Updated 2005-12-17 22:52:20

string equal ?-nocase? ?-length int? string1 string2

Perform a character-by-character comparison of strings string1 and string2. Returns 1 if string1 and string2 are identical, or 0 when not. If -length is specified, then only the first length characters are used in the comparison. If -length is negative, it is ignored. If -nocase is specified, then the strings are compared in a case-insensitive manner.


This command may seem similar to string compare. The difference is that this is only an equal (return value of 1) or not equal (return value of 0) type comparison.

   string equal -nocase -length 3 "abcde" "abcdefg"

returns 1.


See also:


Tcl syntax help - Category Command - Category String Processing