Contents Previous Next Subchapters

Testing String Equality
Syntax left value == right value
left value <> right value
(equal)
(not equal)
See Also element-by-element ==

Description
Tests the row by row equality of two character matrices. If neither left value or right value is a row vector, they must have the same row dimension. Comparisons of character matrices using the equal (==) and not equal (<>) operators return a logical column vector. The i-th element of the return value corresponds to the comparison between the i-th row of the left and right values. O-Matrix considers two rows to be equal if they contain the same characters in the same order not counting trailing spaces.

Tutorial

Comparing Strings
If you enter
     x = "string 1"
     y = "string 2"
     print x == y
O-Matrix will respond
     F

Comparing Matrices
If you enter
     v = {"one ", "two"}
     w = {"one",   "one"}
     v == w
O-Matrix will respond
     {
     T
     F
     }
Note that the string "one " is equal to the string "one" because the trailing space in "one " is ignored.

Comparing Matrices with Strings
If one of the operand is a row vector, each row of the other operand is compared to the row vector. If you enter
     v = {"one ", "two"}
     v == "one"
O-Matrix will respond
     {
     T
     F
     }