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



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






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