Fcitx
|
String handle utilities. More...
#include <cstddef>
#include <initializer_list>
#include <iterator>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <fcitx-utils/fcitxutils_export.h>
#include <fcitx-utils/stringutils_details.h>
Go to the source code of this file.
Enumerations | |
enum | SplitBehavior { KeepEmpty, SkipEmpty } |
Functions | |
bool | fcitx::stringutils::startsWith (std::string_view str, std::string_view prefix) |
Check if a string starts with a prefix. | |
bool | fcitx::stringutils::startsWith (std::string_view str, char prefix) |
Check if a string starts with a prefix char. | |
bool | fcitx::stringutils::endsWith (std::string_view str, std::string_view suffix) |
Check if a string ends with a suffix. | |
bool | fcitx::stringutils::endsWith (std::string_view str, char suffix) |
Check if a string ends with a suffix char. | |
bool | fcitx::stringutils::isConcatOf (std::string_view str, std::string_view sub1, std::string_view sub2) |
Check if a string is a concatenation of two other strings. | |
std::pair< std::string::size_type, std::string::size_type > | fcitx::stringutils::trimInplace (std::string_view str) |
Trim the whitespace by returning start end end of first and list non whitespace character position. More... | |
std::string_view | fcitx::stringutils::trimView (std::string_view) |
Trim the white space in string view. More... | |
std::string | fcitx::stringutils::trim (std::string_view str) |
Trim the white space in str. More... | |
std::vector< std::string > | fcitx::stringutils::split (std::string_view str, std::string_view delim) |
Split the string by delim. | |
std::vector< std::string > | fcitx::stringutils::split (std::string_view str, std::string_view delim, SplitBehavior behavior) |
Split the string by delim. | |
std::string | fcitx::stringutils::replaceAll (std::string str, const std::string &before, const std::string &after) |
Replace all substring appearance of before with after. | |
const char * | fcitx::stringutils::backwardSearch (const char *haystack, size_t l, const char *needle, size_t ol, size_t from) |
Search string needle of size ol in string haystack. More... | |
char * | fcitx::stringutils::backwardSearch (char *haystack, size_t l, const char *needle, size_t ol, size_t from) |
The non-const version of backwardSearch. More... | |
size_t | fcitx::stringutils::backwardSearch (const std::string &haystack, const std::string &needle, size_t from) |
Fast backward substring search. More... | |
template<typename Iter , typename T > | |
std::string | fcitx::stringutils::join (Iter start, Iter end, T &&delim) |
Join a range of string with delim. | |
template<typename C , typename T > | |
std::string | fcitx::stringutils::join (C &&container, T &&delim) |
Join a set of string with delim. | |
template<typename C , typename T > | |
std::string | fcitx::stringutils::join (std::initializer_list< C > &&container, T &&delim) |
Join the strings with delim. | |
template<typename... Args> | |
std::string | fcitx::stringutils::concat (const Args &...args) |
template<typename FirstArg , typename... Args> | |
std::string | fcitx::stringutils::joinPath (const FirstArg &firstArg, const Args &...args) |
constexpr bool | fcitx::stringutils::literalEqual (char const *a, char const *b) |
bool | fcitx::stringutils::unescape (std::string &str, bool unescapeQuote) |
Inplace unescape a string contains slash, new line, optionally quote. | |
std::optional< std::string > | fcitx::stringutils::unescapeForValue (std::string_view str) |
unescape a string, that is potentially quoted. More... | |
std::string | fcitx::stringutils::escapeForValue (std::string_view str) |
escape a string, add quote if needed. More... | |
bool | fcitx::stringutils::consumePrefix (std::string_view &str, std::string_view prefix) |
Return a substring of input str if str starts with given prefix. More... | |
String handle utilities.
Definition in file stringutils.h.