>
>
>
> > but, am I right in thinking that the code above would say that
> > the string "z" is "less" than "aa" because it is shorter?
> >=20
> > If so, something doesn't make sense, or am I missing something?
>
> It does seem this would return -1 in this case, so that "z" is "less
> than" "aa".
> Whether that is right or not I do not know. I imagine that _as a string_
> "z" is less than "aa", so I guess that is right.
>
> Would you expect the ordering to be based on lexical order? So that
> anything beginning with "z" would be larger than anything beginning with
> "a" perhaps?
>
> I'm not sure what the old standard C libs do in this case, but I suspect
> that lexical ordering only works for single characters, not for strings,
> and even then would need to take account of locales, since many
> languages order the alphabet differently to the default English ordering
> used by ASCII.
>
> Or am I addressing the wrong question again (I often am!)
>
> Cheers,
> --=20
> Ian
No, unfortunately this code is completely wrong,
the comparison is lexicographical as stated by the man (extract) :

"The strcasecmp() and strncasecmp() return an integer greater than, equal to, 
or less than 0, according as s1 is lexicographically greater than,   equal to, 
or less than s2 after translation of each corresponding character to 
lower-case."

So, no length test should be issued at all IMHO, not to mention that the 
strlen() test is wrong anyway for utf8.

Fabien
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to