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



lol,

Smaller usually means first (when you are sorting anyway). 1 is true and 0 is false. '<' is less than, and '>' is greater than. Maybe you should drink more beer, it is the weekend you know.

Jeff

bart wrote:

That's exactly my problem, i don't want that ;-)
"AAA" shouldn't be smaller then "aaa", should it?

Do you think language settings can make a difference while comparing
strings? This can be important to me, since i mostly work in an mixed
english/dutch environment.


On Sat, 2004-04-10 at 23:52, Murray Cumming wrote:
On Sat, 2004-04-10 at 23:27, 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
[snip]
----------------------------------------------------
#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;
}
I get
 1
 0
 0
which is what I think you want. My LANG is en_US.UTF-8, which probably
makes some difference.

_______________________________________________
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]