}
/**
- * zak_utils_gstring_replace:
+ * zak_utils_string_replace_full:
+ * @string:
+ * @origin:
+ * @replace:
+ *
+ */
+gchar
+*zak_utils_string_replace_full (const gchar *string,
+ const gchar *origin,
+ const gchar *replace)
+{
+ gchar *ret;
+ gchar *p;
+
+ if (string == NULL) return NULL;
+ if (origin == NULL || replace == NULL) return g_strdup (string);
+
+ ret = g_strdup (string);
+
+ do
+ {
+ p = g_strstr_len (ret, -1, origin);
+
+ if (p == NULL)
+ {
+ return ret;
+ }
+
+ ret = g_strndup (ret, p - ret);
+
+ ret = g_strdup_printf ("%s%s%s", ret, replace, p + strlen (origin));
+ } while (TRUE);
+
+ return ret;
+}
+
+/**
+ * zak_utils_gstring_replace_full:
* @string:
* @origin:
* @replace:
*
*/
void
-zak_utils_gstring_replace (GString *string,
- const gchar *origin,
- const gchar *replace)
+zak_utils_gstring_replace_full (GString *string,
+ const gchar *origin,
+ const gchar *replace)
{
gchar *str;
- str = zak_utils_string_replace ((const gchar *)string->str, origin, replace);
+ str = zak_utils_string_replace_full ((const gchar *)string->str, origin, replace);
g_string_assign (string, str);
gchar *zak_utils_string_replace (const gchar *string,
const gchar *origin,
const gchar *replace);
+gchar *zak_utils_string_replace_full (const gchar *string,
+ const gchar *origin,
+ const gchar *replace);
void zak_utils_gstring_replace (GString *string,
const gchar *origin,
const gchar *replace);
+void zak_utils_gstring_replace_full (GString *string,
+ const gchar *origin,
+ const gchar *replace);
gdouble zak_utils_round (gdouble value, guint n_decimals);