diff src/util.h @ 11920:52f27ffe68a5

[gaim-migrate @ 14211] sf patch #1339035, from Sadrul Habib Chowdhury "Remove the \n in Yahoo! status messages when showing them in the buddy list inline." Also some changes from me. I changed gaim_str_strip_cr(char *text) to gaim_str_strip_char(char *text, char thechar). I don't know why, really, but it seems like it could be more useful this way. Eh committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 31 Oct 2005 04:27:06 +0000
parents f672349cfc1c
children 36a0c8719af3
line wrap: on
line diff
--- a/src/util.h	Mon Oct 31 03:55:56 2005 +0000
+++ b/src/util.h	Mon Oct 31 04:27:06 2005 +0000
@@ -574,11 +574,30 @@
 char *gaim_str_add_cr(const char *str);
 
 /**
- * Strips all carriage returns from a string.
+ * Strips all instances of the given character from the
+ * given string.  The string is modified in place.  This
+ * is useful for stripping new line characters, for example.
+ *
+ * Example usage:
+ * gaim_str_strip_char(my_dumb_string, '\n');
  *
- * @param str The string to strip carriage returns from.
+ * @param str     The string to strip characters from.
+ * @param thechar The character to strip from the given string.
  */
-void gaim_str_strip_cr(char *str);
+void gaim_str_strip_char(char *str, char thechar);
+
+/**
+ * Given a string, this replaces all instances of one character
+ * with another.  This happens inline (the original string IS
+ * modified).
+ *
+ * @param string The string from which to replace stuff.
+ * @param delimiter The character you want replaced.
+ * @param replacement The character you want inserted in place
+ *        of the delimiting character.
+ */
+void gaim_util_chrreplace(char *string, char delimiter,
+						  char replacement);
 
 /**
  * Given a string, this replaces one substring with another