Functions | |
std::string | fill_left (const std::string &s, size_t width, char fill=' ') |
Fill string with characters to the left until the given width is reached. More... | |
std::string | fill_right (const std::string &s, size_t width, char fill=' ') |
Fill string with characters to the right until the given width is reached. More... | |
std::string | fill_both (const std::string &s, size_t width, char fill=' ') |
Fill string with characters at both sides until the given width is reached. More... | |
template<typename octet_type > | |
uint8_t | mask8 (octet_type oc) |
Extract the first byte from a given value. More... | |
template<typename octet_iterator > | |
std::iterator_traits< octet_iterator >::difference_type | sequence_length (octet_iterator lead_it) |
Given an iterator to the beginning of a UTF-8 sequence, return the length of the next UTF-8 code point. More... | |
static size_t | adjust (const std::string &s, size_t width) |
Adjust filling width by taking the size of unicode characters into account. More... | |
std::string smash::utf8::fill_left | ( | const std::string & | s, |
size_t | width, | ||
char | fill = ' ' |
||
) |
Fill string with characters to the left until the given width is reached.
[in] | s | Input string. |
[in] | width | Total width of output string. |
[in] | fill | Filling character. |
Definition at line 48 of file stringfunctions.cc.
std::string smash::utf8::fill_right | ( | const std::string & | s, |
size_t | width, | ||
char | fill = ' ' |
||
) |
Fill string with characters to the right until the given width is reached.
[in] | s | Input string. |
[in] | width | Total width of output string. |
[in] | fill | Filling character. |
Definition at line 56 of file stringfunctions.cc.
std::string smash::utf8::fill_both | ( | const std::string & | s, |
size_t | width, | ||
char | fill = ' ' |
||
) |
Fill string with characters at both sides until the given width is reached.
[in] | s | Input string. |
[in] | width | Total width of output string. |
[in] | fill | Filling character. |
Definition at line 64 of file stringfunctions.cc.
|
inline |
Extract the first byte from a given value.
This function was taken from the Boost-licensed library UTF8-CPP. See http://utfcpp.sourceforge.net/.
octet_type | Type for one byte |
Definition at line 110 of file stringfunctions.h.
|
inline |
Given an iterator to the beginning of a UTF-8 sequence, return the length of the next UTF-8 code point.
This function was taken from the Boost-licensed library UTF8-CPP. See http://utfcpp.sourceforge.net/.
Definition at line 123 of file stringfunctions.h.
|
inlinestatic |
Adjust filling width by taking the size of unicode characters into account.
This is necessary, because UTF-8 characters can be represented by more than byte.
[in] | s | String to be filled. |
[in] | width | Width (in bytes) to be adjusted. |
Definition at line 28 of file stringfunctions.cc.