Added strRTrimSpace and strTrimSpace.

This commit is contained in:
Бранимир Караџић
2021-01-22 19:25:23 -08:00
parent 1d8a0c16e7
commit 99d4cb78ad
3 changed files with 56 additions and 0 deletions

View File

@@ -494,6 +494,33 @@ TEST_CASE("Trim", "")
REQUIRE(0 == bx::strCmp(bx::strTrim(uri.getPath(), "/"), "555333/podmac") );
}
TEST_CASE("TrimSpace", "")
{
REQUIRE(bx::strLTrimSpace("").isEmpty() );
REQUIRE(bx::strRTrimSpace("").isEmpty() );
REQUIRE(bx::strTrimSpace( "").isEmpty() );
const bx::StringView t0("1389");
const bx::StringView t1(" 1389");
const bx::StringView t2("1389 ");
const bx::StringView t3(" 1389 ");
REQUIRE(0 == bx::strCmp(bx::strLTrimSpace(t0), t0) );
REQUIRE(0 == bx::strCmp(bx::strLTrimSpace(t1), t0) );
REQUIRE(0 == bx::strCmp(bx::strLTrimSpace(t2), t2) );
REQUIRE(0 == bx::strCmp(bx::strLTrimSpace(t3), "1389 ") );
REQUIRE(0 == bx::strCmp(bx::strRTrimSpace(t0), t0) );
REQUIRE(0 == bx::strCmp(bx::strRTrimSpace(t1), t1) );
REQUIRE(0 == bx::strCmp(bx::strRTrimSpace(t2), t0) );
REQUIRE(0 == bx::strCmp(bx::strRTrimSpace(t3), " 1389") );
REQUIRE(0 == bx::strCmp(bx::strTrimSpace(t0), t0) );
REQUIRE(0 == bx::strCmp(bx::strTrimSpace(t1), t0) );
REQUIRE(0 == bx::strCmp(bx::strTrimSpace(t2), t0) );
REQUIRE(0 == bx::strCmp(bx::strTrimSpace(t3), t0) );
}
TEST_CASE("strWord", "")
{
REQUIRE(bx::strWord(" abvgd-1389.0").isEmpty() );