From: Andrea Zagli Date: Sat, 2 Jun 2018 09:27:55 +0000 (+0200) Subject: Added function ::gstring_replace. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=1a7cce0f3487af32d134ea006d684003333ec79e;p=libzakutils Added function ::gstring_replace. --- diff --git a/src/generic.c b/src/generic.c index 99e3d0a..f3e0fd5 100644 --- a/src/generic.c +++ b/src/generic.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2017 Andrea Zagli + * Copyright (C) 2015-2018 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -80,6 +80,27 @@ gchar return ret; } +/** + * zak_utils_gstring_replace: + * @string: + * @origin: + * @replace: + * + */ +void +zak_utils_gstring_replace (GString *string, + const gchar *origin, + const gchar *replace) +{ + gchar *str; + + str = zak_utils_string_replace ((const gchar *)string->str, origin, replace); + + g_string_assign (string, str); + + g_free (str); +} + /** * zak_utils_round: * @value: diff --git a/src/generic.h b/src/generic.h index 34f7b2e..243346b 100644 --- a/src/generic.h +++ b/src/generic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2017 Andrea Zagli + * Copyright (C) 2015-2018 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,6 +33,9 @@ gboolean zak_utils_file_exists (const gchar *filename); gchar *zak_utils_string_replace (const gchar *string, const gchar *origin, const gchar *replace); +void zak_utils_gstring_replace (GString *string, + const gchar *origin, + const gchar *replace); gdouble zak_utils_round (gdouble value, guint n_decimals);