Move TrimWhitespace from core to logic.
This commit is contained in:
@@ -1304,36 +1304,6 @@ char *sm_strdup(const char *str)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
{
|
||||
char *end = str + len - 1;
|
||||
|
||||
if (!len)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Iterate backwards through string until we reach first non-whitespace char */
|
||||
while (end >= str && textparsers->IsWhitespace(end))
|
||||
{
|
||||
end--;
|
||||
len--;
|
||||
}
|
||||
|
||||
/* Replace first whitespace char (at the end) with null terminator.
|
||||
* If there is none, we're just replacing the null terminator.
|
||||
*/
|
||||
*(end + 1) = '\0';
|
||||
|
||||
while (*str != '\0' && textparsers->IsWhitespace(str))
|
||||
{
|
||||
str++;
|
||||
len--;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
char *UTIL_ToLowerCase(const char *str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
||||
Reference in New Issue
Block a user