I was wondering... Does anyone know the difference between these 2 codes ?
String A,B; if (A == B) ...
and
String A,B; if (A.compare(B) == 0) ...
Both seem to work.
I was wondering... Does anyone know the difference between these 2 codes ?
String A,B; if (A == B) ...
and
String A,B; if (A.compare(B) == 0) ...
Both seem to work.
The equality operator calls the compare function.
https://github.com/julianstorer/JUCE/blob/master/modules/juce_core/text/juce_String.cpp#L574
you could read the source code in juce_String.cpp at line 574.
the == operator actually calls A.compare(B) == 0
You're right. I (wrongly) keep thinking that the API lists functions which are useful for the final developer...
So selfish !
:)
Both functions are useful for the final developer ; it depends of situations and taste ;-)
If you care about under the hood machinery (for optimization for instance) the JUCE sources are (IMHO) easily browsable. Personnaly i go through them more often than i open the html documentation.