libxcks
0.1.0.1
|
String utilities. More...
#include <string>
#include <ctime>
Go to the source code of this file.
Functions | |
void | libxcks::ltrim (std::string &s) |
Trim from start (in place). More... | |
void | libxcks::rtrim (std::string &s) |
Trim from end (in place). More... | |
void | libxcks::trim (std::string &s) |
Trim from both ends (in place). More... | |
std::string | libxcks::ltrim_copy (std::string s) |
Trim from start (copying). More... | |
std::string | libxcks::rtrim_copy (std::string s) |
Trim from end (copying). More... | |
std::string | libxcks::trim_copy (std::string s) |
Trim from both ends (copying). More... | |
std::string | libxcks::replaceAllCopy (std::string str, const std::string &from, const std::string &to) |
Replace all occurrences of a substring by another in a string. More... | |
void | libxcks::replaceAll (std::string &str, const std::string &from, const std::string &to) |
Replace in-place all occurrences of a substring by another in a string. More... | |
bool | libxcks::stringICompare (const std::string &str1, const std::string &str2) |
Case-insensitive comparison of two strings. More... | |
std::string | libxcks::from_u8string (const std::string &s) |
Returns an UTF-8 encoded string in an object of type std::string (C++17). More... | |
std::string | libxcks::from_u8string (std::string &&s) |
Returns an UTF-8 encoded string in an object of type std::string (C++17). More... | |
time_t | libxcks::parseISO8601 (const std::string &iso8601) |
Parse ISO 8601 date/time. More... | |
std::string | libxcks::escapeForXML (const std::string &str) |
Escapes a string for writing it in a XML stream. More... | |
String utilities.
Definition in file strutil.hpp.
std::string libxcks::escapeForXML | ( | const std::string & | str | ) |
Escapes a string for writing it in a XML stream.
str | The string to escape. |
Definition at line 318 of file strutil.cpp.
std::string libxcks::from_u8string | ( | const std::string & | s | ) |
Returns an UTF-8 encoded string in an object of type std::string
(C++17).
This function just returns the string.
[in] | s | The UTF-8 encoded string. |
Definition at line 217 of file strutil.cpp.
std::string libxcks::from_u8string | ( | std::string && | s | ) |
Returns an UTF-8 encoded string in an object of type std::string
(C++17).
This function just moves the string.
[in] | s | The UTF-8 encoded string. |
Definition at line 232 of file strutil.cpp.
void libxcks::ltrim | ( | std::string & | s | ) |
Trim from start (in place).
[in,out] | s | The string to trim from start. |
Definition at line 53 of file strutil.cpp.
std::string libxcks::ltrim_copy | ( | std::string | s | ) |
Trim from start (copying).
[in] | s | The string to trim from start. |
Definition at line 95 of file strutil.cpp.
std::time_t libxcks::parseISO8601 | ( | const std::string & | iso8601 | ) |
Parse ISO 8601 date/time.
[in] | iso8601 | The string containing the ISO 8601 date/time. |
Invalid_DateTime
on unsuccessfully parse. Definition at line 265 of file strutil.cpp.
void libxcks::replaceAll | ( | std::string & | str, |
const std::string & | from, | ||
const std::string & | to | ||
) |
Replace in-place all occurrences of a substring by another in a string.
[in] | str | The string to search in. |
[in] | from | The substring to replace in str . |
[in] | to | The substitution substring. |
from
replaced by to
. Definition at line 166 of file strutil.cpp.
std::string libxcks::replaceAllCopy | ( | std::string | str, |
const std::string & | from, | ||
const std::string & | to | ||
) |
Replace all occurrences of a substring by another in a string.
[in] | str | The string to search in. |
[in] | from | The substring to replace in str . |
[in] | to | The substitution substring. |
from
replaced by to
. Definition at line 145 of file strutil.cpp.
void libxcks::rtrim | ( | std::string & | s | ) |
Trim from end (in place).
[in,out] | s | The string to trim from end. |
Definition at line 67 of file strutil.cpp.
std::string libxcks::rtrim_copy | ( | std::string | s | ) |
Trim from end (copying).
[in] | s | The string to trim from end. |
Definition at line 109 of file strutil.cpp.
bool libxcks::stringICompare | ( | const std::string & | str1, |
const std::string & | str2 | ||
) |
Case-insensitive comparison of two strings.
[in] | str1 | First string to compare. |
[in] | str2 | Second string to compare. |
true
if the two string are case-insensitive equals or false
otherwise. Definition at line 191 of file strutil.cpp.
void libxcks::trim | ( | std::string & | s | ) |
Trim from both ends (in place).
[in,out] | s | The string to trim from both ends. |
Definition at line 81 of file strutil.cpp.
std::string libxcks::trim_copy | ( | std::string | s | ) |
Trim from both ends (copying).
[in] | s | The string to trim from both ends. |
Definition at line 123 of file strutil.cpp.