Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2005-07-18 09:00:41


"Pavol Droba" <droba_at_[hidden]> wrote in message
news:20050717105715.GM17311_at_lenin.felcer.sk...
> On Sat, Jul 16, 2005 at 06:17:28PM -0500, Thore Karlsen wrote:
>> On Sat, 16 Jul 2005 18:46:33 +0200, Pavol Droba <droba_at_[hidden]>
>> wrote:
...

>> But is_iequal only tests for equality, it doesn't provide an ordering of
>> the characters. He's looking for something like is_iless, which I think
>> would be a nice addition too string_algo.
>
> I see. Sorry about that. Somehow I have overlooked this obvious aspect.
>
> You are right, such a function can be usefull. I will add it (but it will
> have
> to wait after the release)

Any thoughts on carrying this one step further. I've the case where I need
not just case insensitivity, but more of an interleaved case sensitivity.
For example using the following:

   int CompareInterleavedCaseChar( char a1, char a2 )
   {
           if( std::toupper(a1) < std::toupper(a2) ) return -1;
      else if( std::toupper(a2) < std::toupper(a1) ) return 1;
      else if( a1 < a2 ) return -1;
      else if( a2 < a1 ) return 1;
      else return 0;
   }

results in the following ordering:

    ABCdef
    ABcDef
    AbcDef
    Abcdef

in other words A < a < B < b < C ...

Thanks,

Jeff Flinn


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net