Re: [gtkmm] comparing Glib::ustring's ...



I get the same output, so maybe this is the way it's supposed to behave.
How's the theory about lexiografic ( dunno correct english term, sorry )
sorting again? I always thougth it's like NUMBERS --> UPPERCASE -->
LOWERCASE

When i put those 2 strings in an list and sort them like
sort(list.begin(),list.end());
they'll be sorted Uppercase first, just like i expected. So there seems
to be some inconsistency here.

Maybe Murray is rigth and has it something to do with my LANG settings..

Bart

On Sun, 2004-04-11 at 00:01, Jeffrey S. Gavin wrote:
> Hmmm,
> 
> I don't see this. 
> 
>  From this:
> 
>     cout << "\"AAA\" < \"aaa\" --> " << (("AAA" < "aaa") ? "true" : 
> "false") << endl;
>    
>     Glib::ustring A = "AAA";
>     Glib::ustring a = "aaa";
>    
>     cout << "A < a --> " << ((A < a) ? "true" : "false") << endl;
>    
>     Glib::ustring test1="AAA",test2="aaa";
>    
>     std::cout << (test1<test2) << std::endl;
>     std::cout << (test1>test2) << std::endl;
>     std::cout << (test1==test2) << std::endl;
> 
> I get:
> 
> "AAA" < "aaa" --> true
> A < a --> true
> 1
> 0
> 0
> 
> What is the output of your program when you run it?
> 
> Jeff
> 
> bart wrote:
> 
> >Hi,
> >
> >When sorting some Glib::ustring's in a list, i encountered a strange
> >problem. If i compare "AAA" to "aaa", i expect "AAA" to be
> >alphabetically first. But according to the overloaded '<', "aaa" is
> >first :S
> >
> >I have always learned uppercase comes first and other STL sorting
> >methods seem to honor this. ( e.g. sort )
> >
> >I am quite pissed off by this behaviour and hope someone can shed some
> >ligth on this. Attached to this message is a scrap of code which
> >illustrates my problem.
> >
> >TIA,
> >
> >Bart
> >
> >----------------------------------------------------
> >#include <iostream>
> >#include <glibmm/ustring.h>
> >
> >int main()
> >{	
> >	Glib::ustring test1="AAA",test2="aaa";
> >	
> >	std::cout << (test1<test2) << std::endl;
> >	std::cout << (test1>test2) << std::endl;
> >	std::cout << (test1==test2) << std::endl;
> >
> >	return 0;
> >}
> >
> >
> >_______________________________________________
> >gtkmm-list mailing list
> >gtkmm-list gnome org
> >http://mail.gnome.org/mailman/listinfo/gtkmm-list
> >
> >  
> >
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]