Test for String Equality

◀ Constructors▶ Append Operators
Amazon To test equality of two string objects, use == or != operators.

If two strings, A and B, are exactly the same, then (A == B) returns true and (A != B) returns false.

Note that these operators can also be used on char arrays. You can use these operators to compare two strings, one string and one char array, and two char arrays. For C users, you can use strcmp(char*, char*) which remains a popular choice for string comparison among C++ users as well.

Next let’s look at how to append characters to a string!

◀ Constructors▶ Append Operators

fShare
Questions? Let me know!