Yeah, I did my own version as well, but it would be nice to have FindNoCase
built in.
way". I'm not sure I even know the definition of elegant any more.
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:%23ZyxQwj%23HHA.748@TK2MSFTNGP04.phx.gbl...
Yeah, but writing
if(!s.Compare(_T("12345"))
is even more confusing than
if(s.Compare(_T("12345")) == 0)
I agree that the compare is less elegant than the operators - but I am
used to it.
I think == and Compare evaluate to the same code, but CompareNoCase() is
definitely useful. I wish there were a FindNoCase() equivalent.
Years ago when it was hard (for me at least) to get CString without MFC, I
wrote my own equivalent for non-MFC projects, and so that I could add
functions like this. I am thinking now of just deriving my classes from
CStringW and CStringA, abolishing all the members which I rewrote, and
keeping the extra ones. FindNoCase() would be easy enough by various
methods: just make a local copy of the two strings, set them both to lower
case, and then use Find(). There'll be more efficient wats if you work
harder of course :-)
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm