diff --git a/include/bx/string.h b/include/bx/string.h index dfb6d09..7465ca1 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -191,15 +191,9 @@ namespace bx int32_t strCat(char* _dst, int32_t _dstSize, const StringView& _str, int32_t _num = INT32_MAX); /// Find character in string. Limit search to _max characters. - const char* strFind(const char* _str, int32_t _max, char _ch); - - /// const char* strFind(const StringView& _str, char _ch); /// Find character in string in reverse. Limit search to _max characters. - const char* strRFind(const char* _str, int32_t _max, char _ch); - - /// const char* strRFind(const StringView& _str, char _ch); /// Find substring in string. Limit search to _max characters. diff --git a/src/filepath.cpp b/src/filepath.cpp index b46619f..5d6ab21 100644 --- a/src/filepath.cpp +++ b/src/filepath.cpp @@ -239,7 +239,7 @@ namespace bx const StringView FilePath::getPath() const { - const char* end = strRFind(m_filePath, INT32_MAX, '/'); + const char* end = strRFind(m_filePath, '/'); if (NULL != end) { return StringView(m_filePath, end+1); @@ -250,7 +250,7 @@ namespace bx const StringView FilePath::getFileName() const { - const char* fileName = strRFind(m_filePath, INT32_MAX, '/'); + const char* fileName = strRFind(m_filePath, '/'); if (NULL != fileName) { return StringView(fileName+1); diff --git a/src/string.cpp b/src/string.cpp index ebc5967..dee6565 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -338,7 +338,7 @@ namespace bx return strCat(_dst, _dstSize, _str.getPtr(), min(_str.getLength(), _num) ); } - const char* strFind(const char* _str, int32_t _max, char _ch) + inline const char* strFind(const char* _str, int32_t _max, char _ch) { for (int32_t ii = 0, len = strLen(_str, _max); ii < len; ++ii) { @@ -356,7 +356,7 @@ namespace bx return strFind(_str.getPtr(), _str.getLength(), _ch); } - const char* strRFind(const char* _str, int32_t _max, char _ch) + inline const char* strRFind(const char* _str, int32_t _max, char _ch) { for (int32_t ii = strLen(_str, _max); 0 <= ii; --ii) { diff --git a/tests/string_test.cpp b/tests/string_test.cpp index ed5b73b..3664964 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -159,9 +159,9 @@ TEST_CASE("strCmpV sort", "") TEST_CASE("strRFind", "") { const char* test = "test"; - REQUIRE(NULL == bx::strRFind(test, 0, 's') ); - REQUIRE(NULL == bx::strRFind(test, 1, 's') ); - REQUIRE(&test[2] == bx::strRFind(test, INT32_MAX, 's') ); + REQUIRE(NULL == bx::strRFind(bx::StringView(test, 0), 's') ); + REQUIRE(NULL == bx::strRFind(bx::StringView(test, 1), 's') ); + REQUIRE(&test[2] == bx::strRFind(test, 's') ); } TEST_CASE("strFindI", "")