flatten 20260225

This commit is contained in:
Timothy Prepscius
2026-02-25 12:39:24 -05:00
commit fa54be052a
315 changed files with 49791 additions and 0 deletions

39
tjp/core/internet/join.hpp Executable file
View File

@@ -0,0 +1,39 @@
// TJP COPYRIGHT HEADER
#pragma once
#include <tjp/core/string/String.h>
#include <tjp/core/string/StringView+concat.hpp>
namespace tjp::core::internet {
inline
void join_(String &base, const StringView &url)
{
if (base.empty())
{
concat_(base, url);
}
else
if (!url.empty())
{
if (base.back() == '/' && url.front() == '/')
concat_(base, url.substr(1));
else
if (base.back() != '/' && url.front() != '/')
concat_(base, "/", url);
else
concat_(base, url);
}
}
template<typename ... Args>
String join(Args&& ...args)
{
String result;
(join_(result, std::forward<Args>(args)), ...);
return result;
}
} // namespace