aboutsummaryrefslogtreecommitdiffstats
path: root/camel/string-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-08-08 02:54:15 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-08-08 02:54:15 +0800
commitcdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a (patch)
treec0b19032195f2616336812603bf3984ce7f92962 /camel/string-utils.c
parent0a9fdd88421c68d3ecdd88bb220c72b111f1fe55 (diff)
downloadgsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar.gz
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar.bz2
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar.lz
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar.xz
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.tar.zst
gsoc2013-evolution-cdb87d2e0a3eaa3e18bfdfa8fdbdf6bac0ca987a.zip
Strip all \n's from the expression
2000-08-07 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_translate_sexp): Strip all \n's from the expression * string-utils.c (strip): New convenience function to strip occurences of a single char from a string svn path=/trunk/; revision=4576
Diffstat (limited to 'camel/string-utils.c')
-rw-r--r--camel/string-utils.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/camel/string-utils.c b/camel/string-utils.c
index 63e9eafabf..023aee16af 100644
--- a/camel/string-utils.c
+++ b/camel/string-utils.c
@@ -31,7 +31,7 @@
gboolean
string_equal_for_glist (gconstpointer v, gconstpointer v2)
{
- return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0;
+ return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0;
}
/* utility func : frees a gchar element in a GList */
@@ -181,10 +181,26 @@ string_unquote (gchar *string)
/* if the string is quoted, unquote it */
g_return_if_fail (string != NULL);
-
+
if (*string == '"' && *(string + strlen (string) - 1) == '"') {
*(string + strlen (string) - 1) = '\0';
if (*string)
memmove (string, string+1, strlen (string));
}
}
+
+gchar *
+strip (gchar *string, gchar c)
+{
+ /* strip all occurances of c from the string */
+ gchar *src, *dst;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ for (src = dst = string; *src; src++)
+ if (*src != c)
+ *dst++ = *src;
+ *dst = '\0';
+
+ return string;
+}