12 #ifndef PLSSVM_DETAIL_STRING_UTILITY_HPP_
13 #define PLSSVM_DETAIL_STRING_UTILITY_HPP_
17 #include <string_view>
28 [[nodiscard]]
bool starts_with(std::string_view str, std::string_view sv) noexcept;
35 [[nodiscard]]
bool starts_with(std::string_view str,
char c) noexcept;
42 [[nodiscard]]
bool ends_with(std::string_view str, std::string_view sv) noexcept;
49 [[nodiscard]]
bool ends_with(std::string_view str,
char c) noexcept;
56 [[nodiscard]]
bool contains(std::string_view str, std::string_view sv) noexcept;
63 [[nodiscard]]
bool contains(std::string_view str,
char c) noexcept;
70 [[nodiscard]] std::string_view
trim_left(std::string_view str) noexcept;
76 [[nodiscard]] std::string_view
trim_right(std::string_view str) noexcept;
82 [[nodiscard]] std::string_view
trim(std::string_view str) noexcept;
91 std::string &
replace_all(std::string &str, std::string_view what, std::string_view with);
129 [[nodiscard]] std::vector<std::string_view>
split(std::string_view str,
char delim =
' ');
Namespace containing implementation details. Should not directly be used by users.
Definition: csvm.hpp:27
bool starts_with(std::string_view str, std::string_view sv) noexcept
Checks if the string str starts with the prefix sv.
std::string as_upper_case(std::string_view str)
Return a new string with the same content as str but all upper case.
std::string & to_upper_case(std::string &str)
Convert the string str to its all upper case representation.
std::string_view trim(std::string_view str) noexcept
Returns a new std::string_view equal to str where all leading and trailing whitespaces are removed.
std::string_view trim_left(std::string_view str) noexcept
Returns a new std::string_view equal to str where all leading whitespaces are removed.
bool ends_with(std::string_view str, std::string_view sv) noexcept
Checks if the string str ends with the suffix sv.
std::string_view trim_right(std::string_view str) noexcept
Returns a new std::string_view equal to str where all trailing whitespaces are removed.
std::vector< std::string_view > split(std::string_view str, char delim=' ')
Split the string str at the positions with delimiter delim and return the sub-strings.
bool contains(std::string_view str, std::string_view sv) noexcept
Checks if the string str contains the string sv.
std::string as_lower_case(std::string_view str)
Return a new string with the same content as str but all lower case.
std::string & to_lower_case(std::string &str)
Convert the string str to its all lower case representation.
std::string & replace_all(std::string &str, std::string_view what, std::string_view with)
Replaces all occurrences of what with with in the string str.