Re: Utf8 strings manipulation



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]