No.
The empty string ""
is not equal to "grape"
.
And "grape"
is not equal to ""
.
The empty string is not equal to any non-empty string.
A compact way of writing this rules is to use a symbol X
to stand for
the string of characters under consideration.
Then:
equals( "", X ) = false if X is not the empty string equals( X, "" ) = false if X is not the empty string
For example, equals( "", "hound")
X
stands for "hound"
.
Also, equals( "poet", "")
X
stands for "poet"
.
Is the string "walnut"
equal to the string "zebra"
?
How many letters of the strings do you need to compare?