Text utilities that do not use locales.
Definition in file text_light.hpp.
Go to the source code of this file.
#include <string>#include <string_view>#include <vector>
Include dependency graph for text_light.hpp:
This graph shows which files directly or indirectly include this file:Namespaces | |
| namespace | utils |
| Utilities. | |
| namespace | utils::text |
| Text utilities. | |
| namespace | utils::text::utf8 |
| UTF8 text utilities. | |
Functions | |
| std::string | utils::text::Trim (const std::string &str) |
| Return trimmed copy of string. | |
| std::string | utils::text::Trim (std::string &&str) |
| Trim string in-place. | |
| std::vector< std::string > | utils::text::Split (std::string_view str, std::string_view separators) |
| std::vector< std::string_view > | utils::text::SplitIntoStringViewVector (std::string_view str, std::string_view separators) |
| std::string | utils::text::Join (const std::vector< std::string > &strs, std::string_view sep) |
| Join string. | |
| std::string | utils::text::Format (double value, int ndigits) |
| Return number formatted. | |
| constexpr bool | utils::text::StartsWith (std::string_view hay, std::string_view needle) noexcept |
Return true if hay starts with needle, false otherwise. | |
| constexpr bool | utils::text::EndsWith (std::string_view hay, std::string_view needle) noexcept |
Return true if hay ends with needle, false otherwise. | |
| bool | utils::text::ICaseStartsWith (std::string_view hay, std::string_view needle) noexcept |
| Case insensitive (ASCII only) variant of StartsWith() | |
| bool | utils::text::ICaseEndsWith (std::string_view hay, std::string_view needle) noexcept |
| Case insensitive (ASCII only) variant of EndsWith() | |
| std::string | utils::text::RemoveQuotes (std::string_view str) |
| bool | utils::text::IsAscii (char ch) noexcept |
| Checks whether the character is an ASCII character. | |
| bool | utils::text::IsAsciiSpace (char ch) noexcept |
| Checks whether the character is a whitespace character in C locale. | |
| bool | utils::text::IsAscii (std::string_view text) noexcept |
| Checks if text contains only ASCII characters. | |
| unsigned | utils::text::utf8::CodePointLengthByFirstByte (unsigned char c) noexcept |
| Returns the length in bytes of the UTF-8 code point by the first byte. | |
| bool | utils::text::utf8::IsWellFormedCodePoint (const unsigned char *bytes, std::size_t length) noexcept |
bytes must not be a nullptr, length must not be 0. | |
| bool | utils::text::utf8::IsValid (const unsigned char *bytes, std::size_t length) noexcept |
bytes must not be a nullptr, length must not be 0. | |
| std::size_t | utils::text::utf8::GetCodePointsCount (std::string_view text) |
| void | utils::text::utf8::TrimTruncatedEnding (std::string &str) |
| void | utils::text::utf8::TrimViewTruncatedEnding (std::string_view &view) |
| std::size_t | utils::text::utf8::GetTextPosByCodePointPos (std::string_view text, std::size_t pos) noexcept |
| void | utils::text::utf8::RemovePrefix (std::string &text, std::size_t count) noexcept |
| void | utils::text::utf8::RemoveViewPrefix (std::string_view &text, std::size_t count) noexcept |
| void | utils::text::utf8::TakePrefix (std::string &text, std::size_t count) noexcept |
| void | utils::text::utf8::TakeViewPrefix (std::string_view &text, std::size_t count) noexcept |
| bool | utils::text::IsUtf8 (std::string_view text) noexcept |
| Checks if text is in utf-8 encoding. | |
| bool | utils::text::IsPrintable (std::string_view text, bool ascii_only=true) noexcept |
| bool | utils::text::IsCString (std::string_view text) noexcept |
| Checks if there are no embedded null ('\0') characters in text. | |
| std::string | utils::text::CamelCaseToSnake (std::string_view camel) |
| convert CamelCase to snake_case(underscore) | |