TString::CompareTo()

Hi there,

In order to standardize TString methods, could you please add a boolean version of TString::CompareTo(), e.g.

Bool_t EqualTo (const char* cs, TString::ECaseCompare cmp=kExact) const { return ( (CompareTo(cs,cmp)==0)?kTRUE:kFALSE ) ; }
Cheers,
Z

PS: The feature I’m interested in here is kIgnoreCase, otherwise a plain “==” would of course do the job.
Adding a new operator for that specific case, e.g. “=~” would be nice too.
Cheers,
Z

[quote=“Zesp”]PS: The feature I’m interested in here is kIgnoreCase, otherwise a plain “==” would of course do the job.
Adding a new operator for that specific case, e.g. “=~” would be nice too.
Cheers,
Z[/quote]

C++ does not have ‘=~’ operator :slight_smile:)) These are two operators.
Of course, you can overload ‘~’ to return something different from TString and ‘=’ which accepts such an object and instead of assignment does case-insensitive comparison.
But such a code will be too obfuscated.

I’ve added TString::EqualTo() as per your suggestion to the trunk (r39166).

Cheers, Fons.