Euphoria
|
Enumerations | |
enum class | eu::CharToStringStyle { eu::smart , eu::include_hex } |
Functions | |
bool | eu::is_number (char b) |
std::string | eu::strip_last_string (const std::string &str, char sep) |
for hello.dog and . gets hello More... | |
std::pair< std::string, std::string > | eu::get_last_string (const std::string &str, char sep) |
for hello.dog gets .dog More... | |
std::string | eu::get_first_chars (const std::string &str, std::size_t count) |
std::string | eu::get_first_chars_with_ellipsis (const std::string &str, unsigned int count) |
std::string | eu::trim_right (const std::string &string_to_trim, std::string_view trim_characters=space_characters) |
Remove characters from the right, stops at a invalid character. More... | |
std::string | eu::trim_left (const std::string &string_to_trim, std::string_view trim_characters=space_characters) |
Remove characters from the left, stops at invalid character. More... | |
std::string | eu::trim (const std::string &string_to_trim, std::string_view trim_characters=space_characters) |
Remove characters from both the start and the end. More... | |
bool | eu::begins_with (const std::string &string_to_test, const std::string &start) |
Tests if a string starts with another string. More... | |
bool | eu::ends_with (const std::string &string_to_test, const std::string &end) |
Tests if a string ends with another string. More... | |
char | eu::to_lower_char (char b) |
char | eu::to_upper_char (char b) |
std::string | eu::to_lower (const std::string &str) |
Generate a string containing only lower characters. More... | |
std::vector< std::string > | eu::to_lower (const std::vector< std::string > &str) |
std::string | eu::to_upper (const std::string &str) |
std::string | eu::from_char_to_string (char c, CharToStringStyle style) |
std::string::size_type | eu::find_first_index_of_mismatch (const std::string &lhs, const std::string &rhs) |
void | eu::replace_all (std::string *string, const std::string &to_find, const std::string &to_replace) |
Replace all occurrences in a string. More... | |
std::string | eu::replace_all (const std::string &string, const std::string &to_find, const std::string &to_replace) |
Replace all occurrences in a string. More... | |
std::string | eu::replace_with_character (const std::string &string, const std::string &to_find, char to_replace) |
void | eu::copy (char *dst, const std::string &src, const std::string::size_type &count) |
Copy a string to a character buffer, adding null terminator at the end. More... | |
std::string | eu::remove_from_end (const std::string &str, const std::string &end) |
template<typename TKey , typename TValue > | |
std::vector< std::string > | eu::to_string_vector (const std::map< TKey, TValue > &map) |
template<typename TKey , typename TValue > | |
std::vector< std::string > | eu::from_key_to_string_vector (const std::map< TKey, TValue > &map) |
template<typename T > | |
std::vector< std::string > | eu::to_string_vector (const std::vector< T > &data) |
template<typename T , typename C > | |
std::vector< std::string > | eu::to_string_vector (const std::vector< T > &data, C callback) |
std::string | eu::strip (const std::string &str, const std::string &ch) |
std::string | eu::remove_consecutive (const std::string &str, const std::string &ch) |
std::vector< std::string > | eu::split (const std::string &s, char delim) |
std::vector< std::string > | eu::split_on_spaces (const std::string &string) |
std::string | eu::get_string_or_empty (bool b, const std::string &str) |
int | eu::compare_string (const std::string &lhs, const std::string &rhs) |
Variables | |
constexpr std::string_view | eu::space_characters = " \n\r\t" |
Space characters. More... | |
Detailed Description
Enumeration Type Documentation
◆ CharToStringStyle
|
strong |
#include <libs/base/src/base/stringutils.h>
Enumerator | |
---|---|
smart | |
include_hex |
Definition at line 112 of file stringutils.h.
Function Documentation
◆ begins_with()
bool eu::begins_with | ( | const std::string & | string_to_test, |
const std::string & | start | ||
) |
#include <libs/base/src/base/stringutils.cc>
Tests if a string starts with another string.
- Parameters
-
string_to_test the string to test. start the start of the string.
- Returns
- true if the start match, false if not.
Definition at line 87 of file stringutils.cc.
◆ compare_string()
int eu::compare_string | ( | const std::string & | lhs, |
const std::string & | rhs | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 498 of file stringutils.cc.
◆ copy()
void eu::copy | ( | char * | dst, |
const std::string & | src, | ||
const std::string::size_type & | count | ||
) |
#include <libs/base/src/base/stringutils.cc>
Copy a string to a character buffer, adding null terminator at the end.
- Parameters
-
dst the destination buffer. src the source string. count the maximum number of characters to copy (including null terminator)
Definition at line 293 of file stringutils.cc.
◆ ends_with()
bool eu::ends_with | ( | const std::string & | string_to_test, |
const std::string & | end | ||
) |
#include <libs/base/src/base/stringutils.cc>
Tests if a string ends with another string.
- Parameters
-
string_to_test the string to test. end the end of the string.
- Returns
- true if the end match, false if not.
Definition at line 101 of file stringutils.cc.
◆ find_first_index_of_mismatch()
std::string::size_type eu::find_first_index_of_mismatch | ( | const std::string & | lhs, |
const std::string & | rhs | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 244 of file stringutils.cc.
◆ from_char_to_string()
std::string eu::from_char_to_string | ( | char | c, |
CharToStringStyle | style | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 168 of file stringutils.cc.
◆ from_key_to_string_vector()
std::vector<std::string> eu::from_key_to_string_vector | ( | const std::map< TKey, TValue > & | map | ) |
#include <libs/base/src/base/stringutils.h>
Definition at line 178 of file stringutils.h.
◆ get_first_chars()
std::string eu::get_first_chars | ( | const std::string & | str, |
std::size_t | count | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 32 of file stringutils.cc.
◆ get_first_chars_with_ellipsis()
std::string eu::get_first_chars_with_ellipsis | ( | const std::string & | str, |
unsigned int | count | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 40 of file stringutils.cc.
◆ get_last_string()
std::pair< std::string, std::string > eu::get_last_string | ( | const std::string & | str, |
char | sep | ||
) |
#include <libs/base/src/base/stringutils.cc>
for hello.dog gets .dog
Definition at line 17 of file stringutils.cc.
◆ get_string_or_empty()
std::string eu::get_string_or_empty | ( | bool | b, |
const std::string & | str | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 457 of file stringutils.cc.
◆ is_number()
bool eu::is_number | ( | char | b | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 471 of file stringutils.cc.
◆ remove_consecutive()
std::string eu::remove_consecutive | ( | const std::string & | str, |
const std::string & | ch | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 347 of file stringutils.cc.
◆ remove_from_end()
std::string eu::remove_from_end | ( | const std::string & | str, |
const std::string & | end | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 313 of file stringutils.cc.
◆ replace_all() [1/2]
std::string eu::replace_all | ( | const std::string & | string, |
const std::string & | to_find, | ||
const std::string & | to_replace | ||
) |
#include <libs/base/src/base/stringutils.cc>
Replace all occurrences in a string.
- Parameters
-
string the source string. to_find the string to find. to_replace the string to replace it.
- Returns
- the modified string.
Definition at line 284 of file stringutils.cc.
◆ replace_all() [2/2]
void eu::replace_all | ( | std::string * | string, |
const std::string & | to_find, | ||
const std::string & | to_replace | ||
) |
#include <libs/base/src/base/stringutils.cc>
Replace all occurrences in a string.
- Parameters
-
string the source string. to_find the string to find. to_replace the string to replace it.
Definition at line 269 of file stringutils.cc.
◆ replace_with_character()
std::string eu::replace_with_character | ( | const std::string & | string, |
const std::string & | to_find, | ||
char | to_replace | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 301 of file stringutils.cc.
◆ split()
std::vector< std::string > eu::split | ( | const std::string & | s, |
char | delim | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 431 of file stringutils.cc.
◆ split_on_spaces()
std::vector< std::string > eu::split_on_spaces | ( | const std::string & | string | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 444 of file stringutils.cc.
◆ strip()
std::string eu::strip | ( | const std::string & | str, |
const std::string & | ch | ||
) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 331 of file stringutils.cc.
◆ strip_last_string()
std::string eu::strip_last_string | ( | const std::string & | str, |
char | sep | ||
) |
#include <libs/base/src/base/stringutils.cc>
for hello.dog and . gets hello
Definition at line 52 of file stringutils.cc.
◆ to_lower() [1/2]
std::string eu::to_lower | ( | const std::string & | str | ) |
#include <libs/base/src/base/stringutils.cc>
Generate a string containing only lower characters.
- Parameters
-
str the string to lower.
- Returns
- the lowered string.
Definition at line 143 of file stringutils.cc.
◆ to_lower() [2/2]
std::vector< std::string > eu::to_lower | ( | const std::vector< std::string > & | str | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 152 of file stringutils.cc.
◆ to_lower_char()
char eu::to_lower_char | ( | char | b | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 116 of file stringutils.cc.
◆ to_string_vector() [1/3]
std::vector<std::string> eu::to_string_vector | ( | const std::map< TKey, TValue > & | map | ) |
#include <libs/base/src/base/stringutils.h>
Definition at line 164 of file stringutils.h.
◆ to_string_vector() [2/3]
std::vector<std::string> eu::to_string_vector | ( | const std::vector< T > & | data | ) |
#include <libs/base/src/base/stringutils.h>
Definition at line 192 of file stringutils.h.
◆ to_string_vector() [3/3]
std::vector<std::string> eu::to_string_vector | ( | const std::vector< T > & | data, |
C | callback | ||
) |
#include <libs/base/src/base/stringutils.h>
Definition at line 207 of file stringutils.h.
◆ to_upper()
std::string eu::to_upper | ( | const std::string & | str | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 159 of file stringutils.cc.
◆ to_upper_char()
char eu::to_upper_char | ( | char | b | ) |
#include <libs/base/src/base/stringutils.cc>
Definition at line 129 of file stringutils.cc.
◆ trim()
std::string eu::trim | ( | const std::string & | string_to_trim, |
std::string_view | trim_characters = space_characters |
||
) |
#include <libs/base/src/base/stringutils.cc>
Remove characters from both the start and the end.
- Parameters
-
string_to_trim the string to remove characters from. trim_characters the characters to remove.
- Returns
- the trimmed string.
Definition at line 79 of file stringutils.cc.
◆ trim_left()
std::string eu::trim_left | ( | const std::string & | string_to_trim, |
std::string_view | trim_characters = space_characters |
||
) |
#include <libs/base/src/base/stringutils.cc>
Remove characters from the left, stops at invalid character.
- Parameters
-
string_to_trim the string to remove characters from. trim_characters the characters to remove.
- Returns
- the trimmed string.
Definition at line 72 of file stringutils.cc.
◆ trim_right()
std::string eu::trim_right | ( | const std::string & | string_to_trim, |
std::string_view | trim_characters = space_characters |
||
) |
#include <libs/base/src/base/stringutils.cc>
Remove characters from the right, stops at a invalid character.
- Parameters
-
string_to_trim the string to remove characters from. trim_characters the characters to remove.
- Returns
- the trimmed string.
Definition at line 65 of file stringutils.cc.
Variable Documentation
◆ space_characters
|
constexpr |
#include <libs/base/src/base/stringutils.h>
Space characters.
- Returns
- the space characters.
Definition at line 24 of file stringutils.h.