Version 9 of eq

Updated 2010-04-13 23:32:11 by BC

Infix operator for string comparison inside expr. Returns true if its arguments are string-equal.

Its opposite part is ne which returns true if its arguments are not string-equal.

Differs from == in such that its arguments cannot be treated as numerical values, so 1 == 1.0 returns true, but 1 eq 1.0 returns false.

Example:

 % expr {"a" eq "b"}
 0
 % expr {"a" ne "b"}
 1
 %

Also comparing text with eq is faster than ==.


Which is more efficient - string compare or eq?