diff options
Diffstat (limited to 'lib/ephy-string.c')
-rw-r--r-- | lib/ephy-string.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/ephy-string.c b/lib/ephy-string.c index 46a6b6d9f..b97e0485c 100644 --- a/lib/ephy-string.c +++ b/lib/ephy-string.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -499,3 +499,32 @@ ephy_str_replace_substring (const char *string, return result; } + +/* copied from egg-toolbar-editor.c */ +gchar * +ephy_str_elide_underscores (const gchar *original) +{ + gchar *q, *result; + const gchar *p; + gboolean last_underscore; + + q = result = g_malloc (strlen (original) + 1); + last_underscore = FALSE; + + for (p = original; *p; p++) + { + if (!last_underscore && *p == '_') + { + last_underscore = TRUE; + } + else + { + last_underscore = FALSE; + *q++ = *p; + } + } + + *q = '\0'; + + return result; +} |