Re: GLib substr function

From: "Stef Walter", Date: 11/04/2009 03:45, Wrote:

>>> substring (GString *str, int index, int len)
>>> {
>>> return g_string_new_len (str->str, index, MIN (str->len - index, len));
>>> }
>> I was wondering why not to add a so simple example in the official docs
>> (maybe in the g_strndup explanation).
> Maybe because it's completely wrong for UTF-8 strings?

Why, then, doesn't glib come with a completely right implementation?

Basic string operations like sub-string and string replace, should be part of glib, and for every string format that glib supports (including plain ASCII). Especially when it's so obvious that a lot of people still do it incorrectly.


   Paralegal Scholarship
Save on Paralegal Training with a Scholarship - Click Now!
Click Here For More Information

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