|
UString
0.1.0
UTF-8 C++11 string library
|
#include <UString.h>
Classes | |
| class | IteratorBase |
| class | ReverseIteratorBase |
Public Types | |
| typedef UChar | value_type |
| using | Iterator = IteratorBase< std::string::iterator > |
| using | ConstIterator = IteratorBase< std::string::const_iterator > |
| using | ReverseIterator = ReverseIteratorBase< Iterator > |
| using | ConstReverseIterator = ReverseIteratorBase< ConstIterator > |
| using | iterator = Iterator |
| using | const_iterator = ConstIterator |
| using | reverse_iterator = ReverseIterator |
| using | const_reverse_iterator = ConstReverseIterator |
Public Member Functions | |
| UString () | |
| UString (const UString &other) USTRING_NOEXCEPT | |
| UString (const char *cstr) USTRING_NOEXCEPT | |
| UString (const std::string &str) USTRING_NOEXCEPT | |
| UString (UChar ch) USTRING_NOEXCEPT | |
| UString & | insert (const UString &other, std::size_t pos) |
| UString & | assign (const UString &other) |
| UString & | assign (const char *other) |
| UString & | operator= (const UString &other) |
| UString & | operator= (const char *other) |
| UString & | append (UChar ch) |
| UString & | append (const UString &str) |
| UString & | append (const char *str) |
| UString & | operator+= (const char *str) |
| UString & | operator+= (const UString &str) |
| void | push_back (UChar ch) |
| void | push_back (const UString &str) |
| UString & | prepend (UChar ch) |
| UString & | prepend (const UString &str) |
| UString & | prepend (const char *str) |
| void | push_front (UChar ch) |
| void | push_front (const UString &str) |
| bool | operator== (const UString &other) const |
| bool | operator== (const char *other) const |
| bool | operator!= (const UString &other) const |
| bool | operator!= (const char *other) const |
| std::string | toStdString () const |
| std::u16string | toStdU16String () const |
| std::u32string | toStdU32String () const |
| UString & | toUpper () |
| UString & | toLower () |
| UString & | toTitleCase () |
| const UChar | at (std::size_t idx) const |
| const UChar | operator[] (std::size_t idx) const |
| UString | subStr (std::size_t start, std::size_t len=npos) const |
| std::size_t | find (UChar ch, std::size_t start=0) const |
| std::size_t | find (const UString &what, std::size_t start=0) const |
| std::size_t | findLastOf (UChar ch, std::size_t pos=npos) const |
| std::size_t | findLastOf (const UString &what, std::size_t pos=npos) const |
| UString & | replace (std::size_t start, std::size_t len, const UString &with) |
| UString & | replaceAll (const UString &what, const UString &with, std::size_t start=0) |
| UString & | replaceFirst (const UString &what, const UString &with, std::size_t start=0) |
| UString & | replaceLast (const UString &what, const UString &with, std::size_t end=npos) |
| UString & | erase (const Iterator &start, const Iterator &stop) |
| UString & | clear () |
| UString & | erase (std::size_t start, std::size_t num=1) |
| Iterator | begin () |
| Iterator | end () |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| ReverseIterator | rbegin () |
| ReverseIterator | rend () |
| ConstReverseIterator | rbegin () const |
| ConstReverseIterator | rend () const |
| std::size_t | length () const |
| std::size_t | size () const |
| std::size_t | maxSize () const |
Static Public Member Functions | |
| static UString | fromStdU16String (const std::u16string &str) |
| static UString | fromStdU32String (const std::u32string &str) |
Static Public Attributes | |
| static const size_t | npos = std::string::npos |
UTF-8 Encoded String
|
inline |
Default constructor which creates an empty string.
| UString::UString | ( | const UString & | other | ) |
| UString::UString | ( | const char * | cstr | ) |
| UString::UString | ( | const std::string & | str | ) |
Construct a UString from a std::string
| str | std::string to copy. |
|
explicit |
Append a character to the current string
| ch | Character to append |
Append a string to the current string
| str | String to append |
| UString& UString::append | ( | const char * | str | ) |
Append a C-string to the current string
| str | C-string string to append |
Assigns other to this string
| other | String to assign |
| UString& UString::assign | ( | const char * | other | ) |
Assigns other to this string
| other | String to assign |
| const UChar UString::at | ( | std::size_t | idx | ) | const |
Get character at position idx
|
inline |
Returns a iterator pointing to the beginning of the string
|
inline |
Returns a constant iterator pointing to the beginning of the string
| UString& UString::clear | ( | ) |
Clear this string
|
inline |
Returns a iterator pointing to the end of the string
|
inline |
Returns a constant iterator pointing to the beginning of the string
Erase character(s) at given index
| start | Iterator reference to position to begin erasing |
| stop | Iterator reference to position to stop erasing |
| UString& UString::erase | ( | std::size_t | start, |
| std::size_t | num = 1 |
||
| ) |
Erase character(s) in given iterator range
| start | Index of character to start erasing |
| num | Number of characters to erase |
| std::size_t UString::find | ( | UChar | ch, |
| std::size_t | start = 0 |
||
| ) | const |
Find a UChar character
| ch | character to find |
| start | Position to begin searching from |
| std::size_t UString::find | ( | const UString & | what, |
| std::size_t | start = 0 |
||
| ) | const |
Find a string
| what | String to search for |
| start | Position to begin searching from |
| std::size_t UString::findLastOf | ( | UChar | ch, |
| std::size_t | pos = npos |
||
| ) | const |
Find the last instance of a UChar character
| ch | Character to search for |
| pos | Position of last character to include in search |
| std::size_t UString::findLastOf | ( | const UString & | what, |
| std::size_t | pos = npos |
||
| ) | const |
Find the last instance of a string
| what | String to search for |
| pos | Position of last character to include in search |
|
static |
Convert a string from UTF-16 and return a new UTF-8 encoded string
| str | UTF-16 encoded string to convert |
|
static |
Convert a string from UTF-32 and return a new UTF-8 encoded string
| str | UTF-32 encoded string to convert |
Inserts other string into this one at the given position
If the given position is greater than the length of this string it will be appended.
| other | String to insert |
| pos | Position of the string to insert at |
| std::size_t UString::length | ( | ) | const |
Returns the length of characters in the string
| std::size_t UString::maxSize | ( | ) | const |
Returns the maximum length the string can reach
From CplusPlus.com: This is the maximum potential length the string can reach due to known system or library implementation limitations, but the object is not guaranteed to be able to reach that length: it can still fail to allocate storage at any point before that length is reached.
| bool UString::operator!= | ( | const UString & | other | ) | const |
Check if this string not equals the other.
| bool UString::operator!= | ( | const char * | other | ) | const |
Check if this string not equals the other.
| UString& UString::operator+= | ( | const char * | str | ) |
Append a C-string to the current string
| str | C-string string to append |
Append a string to the current string
| str | String to append |
Assigns other to this string
| other | String to assign |
| UString& UString::operator= | ( | const char * | other | ) |
Assigns other to this string
| other | String to assign |
| bool UString::operator== | ( | const UString & | other | ) | const |
Check if this string equals the other.
| bool UString::operator== | ( | const char * | other | ) | const |
Check if this string equals the other.
| const UChar UString::operator[] | ( | std::size_t | idx | ) | const |
Get character at position idx
Prepend a character to the current string
| ch | Character to prepend |
Prepend a string to the current string
| str | String to prepend |
| UString& UString::prepend | ( | const char * | str | ) |
Prepend a C-string to the current string
| str | C-string to prepend |
| void UString::push_back | ( | UChar | ch | ) |
Append a string to the current string
This is provided for STL compatibility and simply calls append()
| str | String to append |
| void UString::push_back | ( | const UString & | str | ) |
Append a string to the current string
This is provided for STL compatibility and simply calls append()
| str | String to append |
| void UString::push_front | ( | UChar | ch | ) |
| void UString::push_front | ( | const UString & | str | ) |
|
inline |
Returns a reverse iterator pointing to the reverse beginning of the string
|
inline |
Returns a constant reverse iterator pointing to the reverse beginning of the string
|
inline |
Returns a reverse iterator pointing to the reverse end of the string
|
inline |
Returns a constant reverse iterator pointing to the reverse end of the string
Replace part of this string with another string
| start | Start of the section to replace |
| len | Number of characters to replace counting from start |
| with | String to replace cut subsection with |
Replace all instances of a string with another
| what | String to search for |
| with | String to use for replacement |
| start | The position to begin searching at |
| UString& UString::replaceFirst | ( | const UString & | what, |
| const UString & | with, | ||
| std::size_t | start = 0 |
||
| ) |
Replace first instance of a string with another
| what | String to search for |
| with | String to use for replacement |
| start | The position to begin searching at |
| UString& UString::replaceLast | ( | const UString & | what, |
| const UString & | with, | ||
| std::size_t | end = npos |
||
| ) |
Replace last instance of a string with another
| what | String to search for |
| with | String to use for replacement |
| end | The position to end our search at or npos |
| std::size_t UString::size | ( | ) | const |
Returns the size of the string in bytes
| UString UString::subStr | ( | std::size_t | start, |
| std::size_t | len = npos |
||
| ) | const |
Create a new string using a sub-section of this string
| start | Position to start copying characters from |
| len | Number of characters to copy or until the end if len is npos |
| UString& UString::toLower | ( | ) |
Convert any uppercase characters in the string to lower
| std::string UString::toStdString | ( | ) | const |
Convert to std::string.
| std::u16string UString::toStdU16String | ( | ) | const |
Convert to UTF-16 and return it as a std::u16string
| std::u32string UString::toStdU32String | ( | ) | const |
Convert to UTF-32 std::u32string.
| UString& UString::toTitleCase | ( | ) |
Convert string to titleCase
| UString& UString::toUpper | ( | ) |
Convert any lowercase characters in the string to upper
1.8.11