string changes, add path seperator

v2
Brett 2024-10-21 15:02:13 -04:00
parent 3003e424e1
commit e81f590f5e
4 changed files with 38 additions and 10 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake)
set(BLT_VERSION 2.1.4)
set(BLT_VERSION 2.1.5)
set(BLT_TARGET BLT)

View File

@ -252,6 +252,22 @@ namespace blt::string
#endif
}
inline std::string ensure_ends_with_path_separator(std::string_view string)
{
if (ends_with(string, '/'))
return std::string(string);
else
return std::string(string) += '/';
}
inline std::string ensure_ends_with_path_separator(std::string&& string)
{
if (ends_with(string, '/'))
return string;
else
return (std::move(string) + '/');
}
class match
{
private:

@ -1 +1 @@
Subproject commit 63acc3336f941c6f324c88eb9ee4ce623a460cd5
Subproject commit 4817a6d3b8407063cf0328eb92dbb27ee2f55528

View File

@ -130,10 +130,13 @@ namespace blt
{
auto size = pos - from;
auto token = s.substr(from, size);
tokens.emplace_back(token);
if (!token.empty())
tokens.emplace_back(token);
from += size + delim.length();
}
tokens.emplace_back(s.substr(from));
auto str = s.substr(from);
if (!str.empty())
tokens.emplace_back(str);
return tokens;
}
@ -146,10 +149,13 @@ namespace blt
{
auto size = pos - from;
auto token = s.substr(from, size);
tokens.emplace_back(token);
if (!token.empty())
tokens.emplace_back(token);
from += size + 1;
}
tokens.emplace_back(s.substr(from));
auto str = s.substr(from);
if (!str.empty())
tokens.emplace_back(str);
return tokens;
}
@ -162,10 +168,13 @@ namespace blt
{
auto size = pos - from;
auto token = s.substr(from, size);
tokens.push_back(token);
if (!token.empty())
tokens.push_back(token);
from += size + delim.length();
}
tokens.push_back(s.substr(from));
auto str = s.substr(from);
if (!str.empty())
tokens.push_back(str);
return tokens;
}
@ -178,10 +187,13 @@ namespace blt
{
auto size = pos - from;
auto token = s.substr(from, size);
tokens.push_back(token);
if (!token.empty())
tokens.push_back(token);
from += size + 1;
}
tokens.push_back(s.substr(from));
auto str = s.substr(from);
if (!str.empty())
tokens.push_back(str);
return tokens;
}