MODSOFIA-86

This commit is contained in:
Anthony Minessale
2010-08-19 18:22:06 -05:00
parent 7f075c0c28
commit 5481d9a98c
5 changed files with 84 additions and 1 deletions

View File

@@ -716,6 +716,32 @@ SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch
return p;
}
SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str)
{
const char *sp = str;
char *p, *s = NULL;
if (!sp)
return NULL;
while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 20) || (*sp == 11) ) {
sp++;
}
s = strdup(sp);
if (!s)
return NULL;
p = s + (strlen(s) - 1);
while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 20) || (*p == 11) ) {
*p-- = '\0';
}
return s;
}
SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
{
const char *sp = str;