[Scummvm-devel] Make class String case insensitive by default?

James 'Ender' Brown ender at scummvm.org
Mon Jul 24 10:10:23 CEST 2006


With a case-insensitive subclass, I really don't think this problem is a
big one. An overloaded == operator on the normal string class for
dealing with the Stringi (or whatever) class should work fine.

However, .equals() / .equalsIgnoreCase() methods are also fine. I think
the subclass method and an overloaded == operator on String will 'look'
better, but the additional methods does make it much easier to know
which type of comparison is in-use.

I'm tied on the issue of which implementation is 'better' (although that
shouldn't be much of a suprise *g*).


Cheers,
	- Ender

> Max Horn wrote:
> >>   The subclass
> >> proposal is better as it relies on the vtable field which is already
> >> there.  Also it is less error prone as you don't add extra state to
> >> the strings which needs to be maintained.
> > 
> > Aye. Though it doesn't solve the problem of how to deal with  
> > comparing a "sensitive" string with an "insensitive one" (of course  
> > you never said it would). In particular, if not done careful, then
> >   a == b
> > and
> >   b == a
> > might return different values, which would be a big no-no.

-- 
James 'Ender' Brown <ender at scummvm.org>





More information about the Scummvm-devel mailing list