Re: Utf8 strings manipulation



Hi Michael,

Thanks a lot for the idea!! I will use regexp because it will be easier
than doing by hand.

Thanks all!!

El Mon, 29 Sep 2008 08:25:02 -0600
Michael Torrie <torriem gmail com> escribiÃ:

Perriman wrote:
Hi all,

    I'm trying to transform an utf8 string. I have some problems
with it because I don't know how to do it or where I can see an
example (a tutorial, doc or application).

I need transform this text (in utf8):

gtk_source_completion

to:

GtkSourceCompletion.

I don't know how replace a character or delete a character. Perhaps
I need to allocate a gchar* array first and then use g_utf8_strncpy
in all _, I don't know. In that case, I don't know how much memory
I need to allocate.

Can you help me?

Would not using the Glib regex routines[1] be the easiest?  Hacking
stuff with strncpy seems a bit problematic.  In particular you can use
g_regex_replace.  From what I've read, all the glib regular expression
routines work in UTF-8 natively.

[1]
http://library.gnome.org/devel/glib/stable/glib-Perl-compatible-regular-expressions.html





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