11USERVER_NAMESPACE_BEGIN
17std::string
Trim(
const std::string& str);
20std::string
Trim(std::string&& str);
23std::string_view
TrimView(std::string_view str);
25enum class SplitFlags {
27 kCompressAdjacentSeparators = 1 << 0,
35 std::string_view separators,
36 SplitFlags split_flags = SplitFlags::kCompressAdjacentSeparators
47std::string
Join(
const std::vector<std::string>& strs, std::string_view sep);
50std::string
Format(
double value,
int ndigits);
53constexpr bool StartsWith(std::string_view hay, std::string_view needle)
noexcept {
54 return hay.substr(0, needle.size()) == needle;
58constexpr bool EndsWith(std::string_view hay, std::string_view needle)
noexcept {
59 return hay.size() >= needle.size() && hay.substr(hay.size() - needle.size()) == needle;
66bool ICaseEndsWith(std::string_view hay, std::string_view needle)
noexcept;
86bool IsAscii(std::string_view text)
noexcept;
98bool IsValid(
const unsigned char* bytes, std::size_t length)
noexcept;
128void TakePrefix(std::string& text, std::size_t count)
noexcept;
137bool IsUtf8(std::string_view text)
noexcept;
143bool IsPrintable(std::string_view text,
bool ascii_only =
true)
noexcept;