libzypp 17.37.10

String.cc File Reference
`#include <zypp-core/AutoDispose.h>`
`#include <cstdio>`
`#include <cstdarg>`
`#include <iostream>`
`#include <utility>`
`#include <zypp-core/base/String.h>`
`#include <zypp-core/base/LogTools.h>`
`#include <zypp-core/TriBool.h>`
`#include <glib.h>`

Go to the source code of this file.

## Namespaces
namespace | zypp
| Easy-to use interface to the ZYPP dependency resolver.
namespace | zypp::str
| String related utilities and Regular expression matching.

## Macros
#define | RXSPECIALCHARS "\\.*+?^$[()|{"

## Functions
std::string | zypp::str::form (const char *format,...) __attribute__((format(printf
| Printf style construction of std::string.
std::string | zypp::str::strerror (int errno_r) ZYPP_API
| Return string describing the error_r code.
bool | zypp::str::validateUtf8 (std::string_view str)
std::string | zypp::str::codepointToUtf8String (uint32_t unichar)
std::string | zypp::str::hexCodepointToUtf8String (std::string_view hexChar)
String representation of number as octal value with leading '0'.
Optional second argument sets the minimal string width (0 padded). Negative values will cause the number to be left adjusted within the string. Default width is 5 (4 for char).
    octstring(42)           -> "00052"
    octstring(42, 4)        -> "0052"
    octstring(42,-4)        -> "052 "
bool | zypp::str::strToTrue (const C_Str &str) ZYPP_API
| Parsing boolean from string.
bool | zypp::str::strToFalse (const C_Str &str) ZYPP_API
| Return `false` if str is 0, false, no, off, never.
TriBool | zypp::str::strToTriBool (const C_Str &str) ZYPP_API
| Parse `str` into a bool if it's a legal `true` or `false` string; else `indeterminate`.
std::string | zypp::str::gsub (const std::string &str_r, const std::string &from_r, const std::string &to_r) ZYPP_API
| Return a string with all occurrences of `from_r` replaced with `to_r`.
std::string & | zypp::str::replaceAll (std::string &str_r, const std::string &from_r, const std::string &to_r) ZYPP_API
| Replace all occurrences of `from_r` with `to_r` in `str_r` (inplace).
std::string | zypp::str::gsubFun (const std::string &str_r, const std::string &from_r, function< std::string()> to_r)
std::string & | zypp::str::replaceAllFun (std::string &str_r, const std::string &from_r, const function< std::string()> &to_r)
Hexencode.
Encode all characters other than [a-zA-Z0-9] as XX. Todo unsecape() This includes the % character itself, which becomes %25.
std::string | zypp::str::hexencode (const C_Str &str_r)
| Encode all characters other than [a-zA-Z0-9] as XX.
std::string | zypp::str::hexdecode (const C_Str &str_r)
| Decode hexencoded XX sequences.
Case conversion.
std::string | zypp::str::toLower (const std::string &s) ZYPP_API
| Return lowercase version of s.
std::string | zypp::str::toLower (std::string &&s)
std::string | zypp::str::toUpper (const std::string &s) ZYPP_API
| Return uppercase version of s.
std::string | zypp::str::toUpper (std::string &&s)
Trimming whitepace.
Todo optimize l/r trim.
std::string | zypp::str::trim (const std::string &s, const Trim trim_r)
std::string | zypp::str::trim (std::string &&s, const Trim trim_r)
Locate substring.
std::string | zypp::str::stripFirstWord (std::string &line, const bool ltrim_first)
std::string | zypp::str::stripLastWord (std::string &line, const bool rtrim_first)
std::string | zypp::str::getline (std::istream &str, const Trim trim_r) ZYPP_API
| Return stream content up to (but not returning) the next newline.
std::string | zypp::str::getline (std::istream &str, bool trim=false) ZYPP_API
| Return stream content up to (but not returning) the next newline.
std::string | zypp::str::receiveUpTo (std::istream &str, const char delim_r, bool returnDelim_r=false)
| Return stream content up to the next ocurrence of `delim_r` or EOF `delim_r`, if found, is always read from the stream.
Escape.
std::string | zypp::str::escape (const C_Str &str_r, const char c=' ') ZYPP_API
| Escape desired character c using a backslash.
std::string | zypp::str::bEscape (std::string str_r, const C_Str &special_r) ZYPP_API
| Return str_r with '\'-escaped chars occurring in special_r (and '\').
std::string | zypp::str::rxEscapeStr (std::string str_r) ZYPP_API
| Escape plain STRING str_r for use in a regex (not anchored by "^" or "$").
std::string | zypp::str::rxEscapeGlob (std::string str_r) ZYPP_API
| Escape GLOB str_r for use in a regex (not anchored by "^" or "$").

## Macro Definition Documentation

## ◆ RXSPECIALCHARS

#define RXSPECIALCHARS "\\.*+?^$[()|{"

Definition at line 416 of file String.cc.