compare 2 QString, use == != ? or QString::compare ?
-
compare 2 QString, use == != ? or QString::compare ?
which way is better and faster?
thank you -
I Think == is same QString::Compare because == call operator==() and compare also.
-
@opengpu2
Compare gives you the option to ignore case. Also, operator== only gives you true or false, while compare can be used to sort strings.If all you want to do is check that two strings are absolutely equal, I would go for ==
-
IMO
operator==()
is faster because, as first thing, it checks if the sizes are the same.
If you're interested only to test is the string are the same or not, go to==
or!=