Re: g_strstrip question.



* TP Muller <tpm01 aber ac uk> wrote:
While this works fine, I don't think it's really necessary:

g_strstrip is defined like this:

#define g_strstrip( string )    g_strchomp (g_strchug (string))

g_strchug() will actually move the 'real' beginning of the string (ie. after 
skipping any leading spaces) forward. In other words: g_strchug() will return 

You are correct.  My solution is overengineered, as the Glib function
does the correct thing.  Thus
        str = g_strdup("  str  ");
        str = g_strstrip(str);  /* the assignment is superflous */
        g_free(str);

        works fine as expected.

        Regards,
        nash

-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



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