Re: GLib substr function

b0unc3 wrote:
> 2009/4/10 Nelson Benítez León <nbenitezl gmail com>
>> Another way,
>> substring (GString *str, int index, int len)
>> {
>>  return g_string_new_len (str->str, index, MIN (str->len - index, len));
>> }


> First of all thanks to everyone who replayed.
> The implementation using g_srtndup looks ok.
> 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?



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