Re: GLib substr function



On Fri, 2009-04-10 at 12:45 +0200, b0unc3 wrote:

> there is any implementation of a substr function in GLib ?
> 
> I mean :
> string = "hello world"
> g_*substr*(string,2,6)
> output = llo w

substr = g_strndup (string + offset, len);
...
g_free (substr);

should do the trick (assuming that offset < strlen).

Cheers
 -Tim




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