Fix various trim functions (#271)

Trim doesn't handle the case where the whole string should be trimmed,
due to being composed of only trimmable chars.
For example the string "\n" when trimmed with chars " \t\n\r" should
yield the empty string "" and not return "\n".
Some test cases were fixed and some were added.
This commit is contained in:
kingscallop
2022-01-01 18:38:58 +00:00
committed by GitHub
parent 5fea2103d1
commit 0ccbdcaa0c
2 changed files with 16 additions and 4 deletions

View File

@@ -480,7 +480,7 @@ namespace bx
}
}
return _str;
return StringView(_str.getTerm(), _str.getTerm() );
}
StringView strLTrimSpace(const StringView& _str)
@@ -523,7 +523,9 @@ namespace bx
{
return StringView(ptr, ii + 1);
}
}
}
return StringView(_str.getPtr(), _str.getPtr());
}
return _str;
@@ -542,6 +544,8 @@ namespace bx
return StringView(ptr, ii + 1);
}
}
return StringView(_str.getPtr(), _str.getPtr());
}
return _str;