Updated 2012-12-01 04:58:47 by RLE
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.

Or it may seem similar to string match. The difference is that match uses patterns (e.g.,
% string match "fred*" "freda"
1
% string equal "fred*" "freda"
0
%

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

returns 1.
   string equal -length 0 a b

returns 1.


See also edit