Version 2 of ne

Updated 2007-11-10 21:44:27 by dkf

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

Its opposite part is eq, which returns true if its arguments are string-equal.

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

Example:

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

Also comparing text with ne is faster than !=.