.. index:: pair: class; EE::String .. _doxid-class_e_e_1_1_string: class EE::String ================ .. toctree:: :hidden: class_EE_String_BMH.rst Overview ~~~~~~~~ Utility string class that automatically handles conversions between types and encodings :ref:`EE::String ` is a utility string class defined mainly for convenience. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class String { public: // typedefs typedef char32_t :target:`StringBaseType`; typedef std::basic_string<:ref:`StringBaseType`> :target:`StringType`; typedef StringType::iterator :target:`Iterator`; typedef StringType::const_iterator :ref:`ConstIterator`; typedef StringType::reverse_iterator :ref:`ReverseIterator`; typedef StringType::const_reverse_iterator :ref:`ConstReverseIterator`; typedef :ref:`Uint32` :ref:`HashType`; typedef std::basic_string_view<:ref:`StringBaseType`> :target:`View`; // classes class :ref:`BMH`; // fields static const std::size_t :ref:`InvalidPos`; // construction :ref:`String`(); :ref:`String`(char ansiChar, const std::locale& locale = std::locale()); :ref:`String`(wchar_t wideChar); :ref:`String`(:ref:`StringBaseType` utf32Char); :ref:`String`(const char* utf8String); :ref:`String`(const char* utf8String, const size_t& utf8StringSize); :ref:`String`(const std::string& utf8String); :ref:`String`(const std::string_view& utf8String); :ref:`String`(const char* ansiString, const std::locale& locale); :ref:`String`(const std::string& ansiString, const std::locale& locale); :ref:`String`(const wchar_t* wideString); :ref:`String`(const std::wstring& wideString); :ref:`String`(const :ref:`StringBaseType`* utf32String); :ref:`String`(const :ref:`StringType`& utf32String); :ref:`String`(const String& str); :ref:`String`(const :ref:`String::View`& str); // methods static constexpr :ref:`HashType` :ref:`hash`(const char* str); static constexpr :ref:`String::HashType` :target:`hash`(const char* str, :ref:`Int64` len); static String :ref:`escape`(const String& str); static String :ref:`unescape`(const String& str); static :ref:`String::HashType` :ref:`hash`(const std::string& str); static :ref:`String::HashType` :ref:`hash`(const String& str); static bool :ref:`isCharacter`(const int& value); static bool :ref:`isNumber`(const int& value, bool AllowDot = false); static bool :ref:`isNumber`(const std::string& value, bool AllowDot = false); static bool :ref:`isLetter`(const int& value); static bool :ref:`isAlphaNum`(const int& value); static bool :ref:`isHexNotation`(const std::string& value, const std::string& withPrefix = ""); static bool :ref:`isWholeWord`(const std::string& haystack, const std::string& needle, const :ref:`Int64`& startPos); static bool :ref:`isWholeWord`(const String& haystack, const String& needle, const :ref:`Int64`& startPos); static std::vector :ref:`split`(const String& str, const :ref:`StringBaseType`& delim = '\n', const bool& pushEmptyString = false, const bool& keepDelim = false); static std::vector :ref:`split`(const std::string& str, const :ref:`Int8`& delim = '\n', const bool& pushEmptyString = false, const bool& keepDelim = false); static std::vector :ref:`split`(const std::string_view& str, const :ref:`Int8`& delim = '\n', const bool& pushEmptyString = false); static std::vector :ref:`split`(const std::string& str, const std::string& delims, const std::string& delimsPreserve = "", const std::string& quote = "\"", const bool& removeQuotes = false); static std::string :ref:`join`(const std::vector& strArray, const :ref:`Int8`& joinchar = ' ', const bool& appendLastJoinChar = false); static String :ref:`join`(const std::vector& strArray, const :ref:`Int8`& joinchar = ' ', const bool& appendLastJoinChar = false); static std::string :ref:`lTrim`(const std::string& str, char character = ' '); static std::string :ref:`rTrim`(const std::string& str, char character); static std::string :ref:`trim`(const std::string& str, char character = ' '); static std::string_view :ref:`lTrim`(const std::string_view& str, char character = ' '); static std::string_view :ref:`rTrim`(const std::string_view& str, char character); static std::string_view :ref:`trim`(const std::string_view& str, char character = ' '); static void :ref:`trimInPlace`(std::string& str, char character = ' '); static String :ref:`lTrim`(const String& str, char character = ' '); static String :ref:`rTrim`(const String& str, char character = ' '); static String :ref:`trim`(const String& str, char character = ' '); static void :ref:`trimInPlace`(String& str, char character = ' '); static void :ref:`toUpperInPlace`(std::string& str); static std::string :ref:`toUpper`(std::string str); static void :ref:`toLowerInPlace`(std::string& str); static void :ref:`capitalizeInPlace`(std::string& str); static std::string :ref:`toLower`(std::string str); static std::string :ref:`capitalize`(std::string str); static String :ref:`toUpper`(const String& str); static String :ref:`toLower`(const String& str); static String :ref:`capitalize`(const String& str); static std::vector<:ref:`Uint8`> :ref:`stringToUint8`(const std::string& str); static std::string :ref:`Uint8ToString`(const std::vector<:ref:`Uint8`>& v); static void :ref:`insertChar`(String& str, const unsigned int& pos, const :ref:`StringBaseType`& tchar); static void :ref:`strCopy`(char* Dst, const char* Src, unsigned int DstSize); static bool :ref:`startsWith`(const std::string& haystack, const std::string& needle); static bool :ref:`startsWith`(const String& haystack, const String& needle); static bool :ref:`startsWith`(const char* haystack, const char* needle); static bool :ref:`endsWith`(const std::string& haystack, const std::string& needle); static bool :ref:`endsWith`(const String& haystack, const String& needle); static bool :ref:`contains`(const std::string& haystack, const std::string& needle); static bool :ref:`contains`(const String& haystack, const String& needle); static int :target:`fuzzyMatch`(const std::string& string, const std::string& pattern, bool allowUneven = false, bool permissive = false); static void :ref:`replaceAll`(std::string& target, const std::string& that, const std::string& with); static void :ref:`replaceAll`(String& target, const String& that, const String& with); static void :ref:`replace`(std::string& target, const std::string& that, const std::string& with); static void :ref:`replace`(String& target, const String& that, const String& with); static std::string :ref:`removeNumbersAtEnd`(std::string txt); static std::string_view :ref:`numberClean`(std::string_view strNumber); static std::string :ref:`numberClean`(const std::string& strNumber); static void :ref:`numberCleanInPlace`(std::string& strNumber); static std::size_t :ref:`findCloseBracket`(const std::string& string, std::size_t startOffset, char openBracket, char closeBracket); static int :ref:`valueIndex`(const std::string& val, const std::string& strings, int defValue = -1, char delim = ';'); static std::string :ref:`randString`(size_t len, std::string dictionary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); template static std::string :ref:`toString`(const T& i); static std::string :target:`fromFloat`(const :ref:`Float`& value, const std::string& append = "", const std::string& prepend = "", size_t digitsAfterComma = 2); static std::string :target:`fromDouble`(const double& value, const std::string& append = "", const std::string& prepend = "", size_t digitsAfterComma = 2); template static bool :ref:`fromString`(T& t, const std::string& s, std::ios_base&(*)(std::ios_base&) f = std::dec); template static bool :ref:`fromString`(T& t, const String& s, std::ios_base&(*)(std::ios_base&) f = std::dec); template static std::string :target:`format`(std::string_view format, Args&&... args); static void :ref:`formatBuffer`(char* Buffer, int BufferSize, const char* format, ...); static String :ref:`fromUtf8`(const std::string& utf8String); static size_t :ref:`utf8Length`(const std::string& utf8String); static String :ref:`fromUtf8`(const std::string_view& utf8String); static size_t :ref:`utf8Length`(const std::string_view& utf8String); static :ref:`Uint32` :ref:`utf8Next`(char*& utf8String); static bool :ref:`globMatch`(const std::string_view& text, const std::string_view& glob, bool caseInsensitive = false); static bool :ref:`globMatch`(const std::string_view& text, const std::vector& globs, bool caseInsensitive = false); static String :target:`fromWide`(const wchar_t* wideString); static String :target:`fromUtf16`(const char* utf16String, const size_t& utf16StringSize, bool isBigEndian = false); static String :target:`fromLatin1`(const char* string, const size_t& stringSize); template static String :ref:`fromUtf8`(T begin, T end); template static String :ref:`fromUtf16`(T begin, T end); template static String :ref:`fromUtf32`(T begin, T end); static std::string :target:`getFirstLine`(const std::string& string); :ref:`operator std::string`() const; std::string :ref:`toAnsiString`(const std::locale& locale = std::locale()) const; std::wstring :ref:`toWideString`() const; std::string :ref:`toUtf8`() const; std::basic_string<:ref:`Uint16`> :ref:`toUtf16`() const; :ref:`HashType` :ref:`getHash`() const; String& :ref:`operator=`(const String& right); String& :target:`operator=`(String&& right); String& :target:`operator=`(const :ref:`StringBaseType`& right); String& :ref:`operator+=`(const String& right); String& :target:`operator+=`(const :ref:`StringBaseType`& right); const :ref:`StringBaseType`& :ref:`operator[]`(std::size_t index) const; :ref:`StringBaseType`& :ref:`operator[]`(std::size_t index); const :ref:`StringBaseType`& :ref:`at`(std::size_t index) const; void :ref:`clear`(); std::size_t :ref:`size`() const; std::size_t :ref:`length`() const; bool :ref:`empty`() const; void :ref:`erase`(std::size_t position, std::size_t count = 1); String& :ref:`insert`(std::size_t position, const String& str); String& :target:`insert`(size_t pos1, const char* s, size_t n); String& :target:`insert`(std::size_t pos1, const String& str, std::size_t pos2, std::size_t n); String& :target:`insert`(std::size_t pos1, const char* s); String& :target:`insert`(std::size_t pos1, size_t n, const :ref:`String::StringBaseType`& c); :ref:`Iterator` :target:`insert`(:ref:`Iterator` p, const :ref:`String::StringBaseType`& c); void :target:`insert`(:ref:`Iterator` p, std::size_t n, const :ref:`StringBaseType`& c); template void :target:`insert`(:ref:`Iterator` p, InputIterator first, InputIterator last); std::size_t :ref:`find`(const String& str, std::size_t start = 0) const; std::size_t :target:`find`(const char* s, std::size_t pos, std::size_t n) const; std::size_t :target:`find`(const char* s, std::size_t pos = 0) const; std::size_t :target:`find`(const :ref:`String::StringBaseType`& c, std::size_t pos = 0) const; const :ref:`StringBaseType`* :ref:`c_str`() const; const :ref:`StringBaseType`* :ref:`data`() const; :ref:`Iterator` :ref:`begin`(); :ref:`ConstIterator` :ref:`begin`() const; :ref:`Iterator` :ref:`end`(); :ref:`ConstIterator` :ref:`end`() const; :ref:`ReverseIterator` :ref:`rbegin`(); :ref:`ConstReverseIterator` :ref:`rbegin`() const; :ref:`ReverseIterator` :ref:`rend`(); :ref:`ConstReverseIterator` :ref:`rend`() const; void :ref:`resize`(std::size_t n, :ref:`StringBaseType` c); void :ref:`resize`(std::size_t n); std::size_t :ref:`max_size`() const; void :ref:`reserve`(size_t res_arg = 0); std::size_t :ref:`capacity`() const; void :ref:`push_back`(:ref:`StringBaseType` c); void :ref:`swap`(String& str); String& :target:`assign`(const String& str); String& :target:`assign`(const String& str, std::size_t pos, std::size_t n); String& :target:`assign`(const char* s); String& :target:`assign`(std::size_t n, :ref:`StringBaseType` c); template String& :target:`assign`(InputIterator first, InputIterator last); String& :target:`append`(const String& str); String& :target:`append`(const String& str, std::size_t pos, std::size_t n); String& :target:`append`(const char* s); String& :target:`append`(std::size_t n, char c); String& :target:`append`(std::size_t n, :ref:`StringBaseType` c); template String& :target:`append`(InputIterator first, InputIterator last); String& :target:`replace`(std::size_t pos1, std::size_t n1, const String& str); String& :target:`replace`(:ref:`Iterator` i1, :ref:`Iterator` i2, const String& str); String& :target:`replace`(std::size_t pos1, std::size_t n1, const String& str, std::size_t pos2, std::size_t n2); String& :target:`replace`(std::size_t pos1, std::size_t n1, const char* s, std::size_t n2); String& :target:`replace`(:ref:`Iterator` i1, :ref:`Iterator` i2, const char* s, std::size_t n2); String& :target:`replace`(std::size_t pos1, std::size_t n1, const char* s); String& :target:`replace`(:ref:`Iterator` i1, :ref:`Iterator` i2, const char* s); String& :target:`replace`(std::size_t pos1, std::size_t n1, std::size_t n2, :ref:`StringBaseType` c); String& :target:`replace`(:ref:`Iterator` i1, :ref:`Iterator` i2, std::size_t n2, :ref:`StringBaseType` c); template String& :target:`replace`(:ref:`Iterator` i1, :ref:`Iterator` i2, InputIterator j1, InputIterator j2); std::size_t :target:`rfind`(const String& str, std::size_t pos = StringType::npos) const; std::size_t :target:`rfind`(const char* s, std::size_t pos = StringType::npos) const; std::size_t :target:`rfind`(const :ref:`StringBaseType`& c, std::size_t pos = StringType::npos) const; String :target:`substr`(std::size_t pos = 0, std::size_t n = StringType::npos) const; std::size_t :target:`copy`(:ref:`StringBaseType`* s, std::size_t n, std::size_t pos = 0) const; int :target:`compare`(const String& str) const; int :target:`compare`(const char* s) const; int :target:`compare`(std::size_t pos1, std::size_t n1, const String& str) const; int :target:`compare`(std::size_t pos1, std::size_t n1, const char* s) const; int :target:`compare`(std::size_t pos1, std::size_t n1, const String& str, std::size_t pos2, std::size_t n2) const; int :target:`compare`(std::size_t pos1, std::size_t n1, const char* s, std::size_t n2) const; std::size_t :target:`find_first_of`(const String& str, std::size_t pos = 0) const; std::size_t :target:`find_first_of`(const char* s, std::size_t pos = 0) const; std::size_t :target:`find_first_of`(:ref:`StringBaseType` c, std::size_t pos = 0) const; std::size_t :target:`find_last_of`(const String& str, std::size_t pos = StringType::npos) const; std::size_t :target:`find_last_of`(const char* s, std::size_t pos = StringType::npos) const; std::size_t :target:`find_last_of`(:ref:`StringBaseType` c, std::size_t pos = StringType::npos) const; std::size_t :target:`find_first_not_of`(const String& str, std::size_t pos = 0) const; std::size_t :target:`find_first_not_of`(const char* s, std::size_t pos = 0) const; std::size_t :target:`find_first_not_of`(:ref:`StringBaseType` c, std::size_t pos = 0) const; std::size_t :target:`find_last_not_of`(const String& str, std::size_t pos = StringType::npos) const; std::size_t :target:`find_last_not_of`(const char* s, std::size_t pos = StringType::npos) const; std::size_t :target:`find_last_not_of`(:ref:`StringBaseType` c, std::size_t pos = StringType::npos) const; size_t :target:`countChar`(:ref:`StringBaseType` c) const; String& :target:`padLeft`(unsigned int minDigits, :ref:`StringBaseType` padChar); String& :target:`toLower`(); String& :target:`toUpper`(); String& :target:`capitalize`(); String& :target:`escape`(); String& :target:`unescape`(); :ref:`StringBaseType` :target:`lastChar`() const; std::vector :target:`split`(const :ref:`StringBaseType`& delim = '\n', const bool& pushEmptyString = false, const bool& keepDelim = false) const; String :target:`getFirstLine`(); void :ref:`replaceAll`(const String& that, const String& with); void :target:`pop_back`(); const :ref:`StringBaseType`& :target:`front`() const; const :ref:`StringBaseType`& :target:`back`() const; String& :target:`trim`(char character = ' '); String& :target:`lTrim`(char character = ' '); String& :target:`rTrim`(char character = ' '); bool :ref:`contains`(const String& needle); :ref:`String::View` :target:`view`() const; :ref:`EE_API` bool :ref:`operator==`(const String& left, const String& right); :ref:`EE_API` bool :ref:`operator!=`(const String& left, const String& right); :ref:`EE_API` bool :ref:`operator<`(const String& left, const String& right); :ref:`EE_API` bool :ref:`operator>`(const String& left, const String& right); :ref:`EE_API` bool :ref:`operator<=`(const String& left, const String& right); :ref:`EE_API` bool :ref:`operator>=`(const String& left, const String& right); :ref:`EE_API` String :ref:`operator+`(const String& left, const String& right); }; .. _details-class_e_e_1_1_string: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Utility string class that automatically handles conversions between types and encodings :ref:`EE::String ` is a utility string class defined mainly for convenience. It is a Unicode string (implemented using UTF-32), thus it can store any character in the world (european, chinese, arabic, hebrew, etc.). It automatically handles conversions from/to ANSI and wide strings, so that you can work with standard string classes and still be compatible with functions taking a :ref:`EE::String `. .. ref-code-block:: cpp EE::String s; std::string s1 = s; // automatically converted to ANSI string String s2 = s; // automatically converted to wide string s = "hello"; // automatically converted from ANSI string s = L"hello"; // automatically converted from wide string s += 'a'; // automatically converted from ANSI string s += L'a'; // automatically converted from wide string Conversions involving ANSI strings use the default user locale. However it is possible to use a custom locale if necessary: .. ref-code-block:: cpp std::locale locale; EE::String s; ... std::string s1 = s.toAnsiString(locale); s = EE::String("hello", locale); :ref:`EE::String ` defines the most important functions of the standard std::string class: removing, random access, iterating, appending, comparing, etc. However it is a simple class provided for convenience, and you may have to consider using a more optimized class if your program requires complex string handling. The automatic conversion functions will then take care of converting your string to :ref:`EE::String ` whenever :ref:`EE ` requires it. Please note that :ref:`EE ` also defines a low-level, generic interface for Unicode handling, see the :ref:`EE::Utf ` classes. All credits to Laurent Gomila, i just modified and expanded a little bit the implementation. Typedefs -------- .. index:: pair: typedef; ConstIterator .. _doxid-class_e_e_1_1_string_1a95ce10a148456fba9139c2244c8d6479: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef StringType::const_iterator ConstIterator Iterator type. .. index:: pair: typedef; ReverseIterator .. _doxid-class_e_e_1_1_string_1a8fb9993282625c82ec13b77715964754: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef StringType::reverse_iterator ReverseIterator Constant iterator type. .. index:: pair: typedef; ConstReverseIterator .. _doxid-class_e_e_1_1_string_1ab4b1087252ef5720901c26fb65008678: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef StringType::const_reverse_iterator ConstReverseIterator Reverse Iterator type. .. index:: pair: typedef; HashType .. _doxid-class_e_e_1_1_string_1a105c2ab365f2a3085c714617f129b386: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef :ref:`Uint32` HashType Constant iterator type. Fields ------ .. index:: pair: variable; InvalidPos .. _doxid-class_e_e_1_1_string_1a3b4a1e32bb9becd0a10fc113bda07783: .. ref-code-block:: cpp :class: doxyrest-title-code-block static const std::size_t InvalidPos Represents an invalid position in the string. Construction ------------ .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1ab23b3467ef6675e6d8c7764c3a9a79a8: .. ref-code-block:: cpp :class: doxyrest-title-code-block String() Default constructor This constructor creates an empty string. .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a0851c5c55cad9af5e1f2031add84dffa: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(char ansiChar, const std::locale& locale = std::locale()) Construct from a single ANSI character and a locale The source character is converted to UTF-32 according to the given locale. If you want to use the current global locale, rather use the other constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ansiChar - ANSI character to convert * - locale - Locale to use for conversion .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1ae1647d1338aacf60acecfa8c174c92b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(wchar_t wideChar) Construct from single wide character. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - wideChar - Wide character to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a5c9f99a780248526b6bfa8bdc133083b: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(:ref:`StringBaseType` utf32Char) Construct from single UTF-32 character. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf32Char - UTF-32 character to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a10e171c0ffa447671b7604889b5719e7: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const char* utf8String) Construct from an from a null-terminated C-style UTF-8 string to UTF-32. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - uf8String - UTF-8 string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a86c9c869aa0f11d8164dd4a9ae569c26: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const char* utf8String, const size_t& utf8StringSize) Construct from an from a sub-string C-style UTF-8 string to UTF-32. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - uf8String - UTF-8 string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1aa910d4e643ef1138ff8952faece6b416: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const std::string& utf8String) Construct from an UTF-8 string to UTF-32 according. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf8String - UTF-8 string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a8807e5e6a194e80ef152690d0a24ca09: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const std::string_view& utf8String) Construct from an UTF-8 string to UTF-32 according. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf8String - UTF-8 string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a3bd257dfb6eb151a1ab42a0f13e1bf92: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const char* ansiString, const std::locale& locale) Construct from a null-terminated C-style ANSI string and a locale The source string is converted to UTF-32 according to the given locale. If you want to use the current global locale, rather use the other constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ansiString - ANSI string to convert * - locale - Locale to use for conversion .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a1e91dd9bc2c8bc6376314fa6e3b90e70: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const std::string& ansiString, const std::locale& locale) Construct from an ANSI string and a locale The source string is converted to UTF-32 according to the given locale. If you want to use the current global locale, rather use the other constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ansiString - ANSI string to convert * - locale - Locale to use for conversion .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a49793fe53582130b1242f79c7c413915: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const wchar_t* wideString) Construct from null-terminated C-style wide string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - wideString - Wide string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1ae777e87133e1b42024bddfbd4efc1e1d: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const std::wstring& wideString) Construct from a wide string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - wideString - Wide string to convert .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a08c3be83ba98f8de8dd65feb44caae51: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const :ref:`StringBaseType`* utf32String) Construct from a null-terminated C-style UTF-32 string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf32String - UTF-32 string to assign .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1ab1ed46fa88581842a58305050afa5f63: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const :ref:`StringType`& utf32String) Construct from an UTF-32 string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf32String - UTF-32 string to assign .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a1a65a8ac105e447ca1a1540afefb4420: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const String& str) Copy constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - str - Instance to copy .. index:: pair: function; String .. _doxid-class_e_e_1_1_string_1a8b63a47f56396da32fb8bafd171d3757: .. ref-code-block:: cpp :class: doxyrest-title-code-block String(const :ref:`String::View`& str) Copy constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - str - Instance to copy Methods ------- .. index:: pair: function; hash .. _doxid-class_e_e_1_1_string_1ace03a970102523234262acaa6281c775: .. ref-code-block:: cpp :class: doxyrest-title-code-block static constexpr :ref:`HashType` hash(const char* str) .. rubric:: Returns: string hash .. index:: pair: function; escape .. _doxid-class_e_e_1_1_string_1aa3981985186f6c46f19241847bcbfdd2: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String escape(const String& str) Escape string sequence .. index:: pair: function; unescape .. _doxid-class_e_e_1_1_string_1ab00e975ae02567c9d247cc0123b0fa36: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String unescape(const String& str) Unescape string sequence .. index:: pair: function; hash .. _doxid-class_e_e_1_1_string_1a0551cba8e6eb8da98eafb1ec7d2111a6: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`String::HashType` hash(const std::string& str) .. rubric:: Returns: string hash .. index:: pair: function; hash .. _doxid-class_e_e_1_1_string_1a4949332c3a5618363bd43612dc4c731e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`String::HashType` hash(const String& str) .. rubric:: Returns: string hash. Note: :ref:`String::hash ` ( std::string( "text" ) ) is != to :ref:`String::hash ` (:ref:`String ` ( "text" ) ) .. index:: pair: function; isCharacter .. _doxid-class_e_e_1_1_string_1ad567412d561536f09070468da62a3294: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isCharacter(const int& value) .. rubric:: Returns: If the value passed is a character .. index:: pair: function; isNumber .. _doxid-class_e_e_1_1_string_1a116fae22677adb79b2fd1971c0135082: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isNumber(const int& value, bool AllowDot = false) .. rubric:: Returns: If the value passed is a number .. index:: pair: function; isNumber .. _doxid-class_e_e_1_1_string_1a1024822dcbb310e05e87482559f21618: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isNumber(const std::string& value, bool AllowDot = false) .. rubric:: Returns: If the string represents a number. .. index:: pair: function; isLetter .. _doxid-class_e_e_1_1_string_1ac5150300e0545f71b930ae02a31f9025: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isLetter(const int& value) .. rubric:: Returns: If the value passed is a letter .. index:: pair: function; isAlphaNum .. _doxid-class_e_e_1_1_string_1aa75fb50d6a8ea1c2d247252e87232206: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isAlphaNum(const int& value) .. rubric:: Returns: If the value passed is a letter or a number .. index:: pair: function; isHexNotation .. _doxid-class_e_e_1_1_string_1a12aa7b38155f506c0f5d7bc4e129c66b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isHexNotation(const std::string& value, const std::string& withPrefix = "") .. rubric:: Returns: If the string is a representation of a hexa number .. index:: pair: function; isWholeWord .. _doxid-class_e_e_1_1_string_1a2d4cdbade67c662bce6e4c1d839f7a44: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isWholeWord(const std::string& haystack, const std::string& needle, const :ref:`Int64`& startPos) .. rubric:: Returns: If the needle substring, found starting at startPos is a whole-word. .. index:: pair: function; isWholeWord .. _doxid-class_e_e_1_1_string_1af064287d3ebb85e389fb3a6b9c4eec2b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool isWholeWord(const String& haystack, const String& needle, const :ref:`Int64`& startPos) .. rubric:: Returns: If the needle substring, found starting at startPos is a whole-word. .. index:: pair: function; split .. _doxid-class_e_e_1_1_string_1acad4ddd49e68ac7cb0209a2a6bbd57f8: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector split(const String& str, const :ref:`StringBaseType`& delim = '\n', const bool& pushEmptyString = false, const bool& keepDelim = false) Split a :ref:`String ` and hold it on a vector .. index:: pair: function; split .. _doxid-class_e_e_1_1_string_1aa28f05fee47b085aafa3a335fccc8e1a: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector split(const std::string& str, const :ref:`Int8`& delim = '\n', const bool& pushEmptyString = false, const bool& keepDelim = false) Split a string and hold it on a vector .. index:: pair: function; split .. _doxid-class_e_e_1_1_string_1a4892ae7e0d8a11517030e02be8bff57f: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector split(const std::string_view& str, const :ref:`Int8`& delim = '\n', const bool& pushEmptyString = false) Split a string and hold it on a vector .. index:: pair: function; split .. _doxid-class_e_e_1_1_string_1a9a5216f0114e4d636d1c95a43d4e573e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector split(const std::string& str, const std::string& delims, const std::string& delimsPreserve = "", const std::string& quote = "\"", const bool& removeQuotes = false) Split a string and hold it on a vector. This function is meant to be used for code splitting, detects functions, arrays, braces and quotes for the splitting. .. index:: pair: function; join .. _doxid-class_e_e_1_1_string_1af2cf9092827d40550823e981c9ea7246: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string join(const std::vector& strArray, const :ref:`Int8`& joinchar = ' ', const bool& appendLastJoinChar = false) Joins a string vector into a single string .. index:: pair: function; join .. _doxid-class_e_e_1_1_string_1a2ef9dfb1941bd5f907e5905d6e6a889d: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String join(const std::vector& strArray, const :ref:`Int8`& joinchar = ' ', const bool& appendLastJoinChar = false) Joins a string vector into a single string .. index:: pair: function; lTrim .. _doxid-class_e_e_1_1_string_1a65165191679eac2e333998d3896f7e8b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string lTrim(const std::string& str, char character = ' ') Removes the trailing prefix. .. index:: pair: function; rTrim .. _doxid-class_e_e_1_1_string_1ae270d139c29576c2ae8ada2ac2892662: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string rTrim(const std::string& str, char character) Removes the trailing suffix. .. index:: pair: function; trim .. _doxid-class_e_e_1_1_string_1a19848c48ba60194c983ea87251475557: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string trim(const std::string& str, char character = ' ') Removes all spaces ( or the specified character ) on the string .. index:: pair: function; lTrim .. _doxid-class_e_e_1_1_string_1a610700fdb1c5cecd903e53c9c07455b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string_view lTrim(const std::string_view& str, char character = ' ') Removes the trailing prefix. .. index:: pair: function; rTrim .. _doxid-class_e_e_1_1_string_1a7443c06ecea58acc9660ea0c69a60703: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string_view rTrim(const std::string_view& str, char character) Removes the trailing suffix. .. index:: pair: function; trim .. _doxid-class_e_e_1_1_string_1a762d69e41acbc92bfd207a6b3e7c8945: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string_view trim(const std::string_view& str, char character = ' ') Removes all spaces ( or the specified character ) on the string .. index:: pair: function; trimInPlace .. _doxid-class_e_e_1_1_string_1a2a7c51c9d0f75a186f1f08b458ce27ba: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void trimInPlace(std::string& str, char character = ' ') Removes all spaces ( or the specified character ) on the string .. index:: pair: function; lTrim .. _doxid-class_e_e_1_1_string_1aba762861015a1ca406fc8f350f80e72c: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String lTrim(const String& str, char character = ' ') Removes the trailing prefix. .. index:: pair: function; rTrim .. _doxid-class_e_e_1_1_string_1a147d22b71047a20186ad4fa253e747b6: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String rTrim(const String& str, char character = ' ') Removes the trailing suffix. .. index:: pair: function; trim .. _doxid-class_e_e_1_1_string_1abbe439a2ee04f05689bfc8647a9ded80: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String trim(const String& str, char character = ' ') Removes all spaces ( or the specified character ) on the string .. index:: pair: function; trimInPlace .. _doxid-class_e_e_1_1_string_1ab67fa834d06ac9b6b84d73e5c2135ec2: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void trimInPlace(String& str, char character = ' ') Removes all spaces ( or the specified character ) on the string .. index:: pair: function; toUpperInPlace .. _doxid-class_e_e_1_1_string_1a37c662a8971d3d89152bd79f982fe35a: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void toUpperInPlace(std::string& str) Convert the string into upper case string .. index:: pair: function; toUpper .. _doxid-class_e_e_1_1_string_1a02039f9b2c3aef97136620b51e5c8e45: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string toUpper(std::string str) Convert a string to lower case .. index:: pair: function; toLowerInPlace .. _doxid-class_e_e_1_1_string_1a6afb4fea8c7ebe10f9eef2b42d8de99c: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void toLowerInPlace(std::string& str) Convert the reference of a string into lower case string .. index:: pair: function; capitalizeInPlace .. _doxid-class_e_e_1_1_string_1a05f48af2256c2fb8606319370813766c: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void capitalizeInPlace(std::string& str) Capitalizes the reference of a string .. index:: pair: function; toLower .. _doxid-class_e_e_1_1_string_1ae107e80b3263258bf4e714f54b70f7b3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string toLower(std::string str) Convert a string to lower case .. index:: pair: function; capitalize .. _doxid-class_e_e_1_1_string_1a2d127f25b6961e176020dfc2b3d222e7: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string capitalize(std::string str) Catitalize a string .. index:: pair: function; toUpper .. _doxid-class_e_e_1_1_string_1a198dde135089cf4e07bed1a25bd48e21: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String toUpper(const String& str) Convert a string to lower case .. index:: pair: function; toLower .. _doxid-class_e_e_1_1_string_1a836315c14a78e8f885081a58797995ce: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String toLower(const String& str) Convert a string to lower case .. index:: pair: function; capitalize .. _doxid-class_e_e_1_1_string_1ad2f093f325665fbc5b4ca877dce6498c: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String capitalize(const String& str) Capitalizes a string .. index:: pair: function; stringToUint8 .. _doxid-class_e_e_1_1_string_1a0b481f56c41dc5dd74bdf1f43f4b1902: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector<:ref:`Uint8`> stringToUint8(const std::string& str) Convert the string to an std::vector .. index:: pair: function; Uint8ToString .. _doxid-class_e_e_1_1_string_1a990d5de00a6d7d121acc13595e05b5da: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string Uint8ToString(const std::vector<:ref:`Uint8`>& v) Convert the std::vector to an string .. index:: pair: function; insertChar .. _doxid-class_e_e_1_1_string_1a2076e1d465245a5305d0907f18ce1f8b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void insertChar(String& str, const unsigned int& pos, const :ref:`StringBaseType`& tchar) Insert a char into :ref:`String ` on pos (added this function to avoid a bug on :ref:`String `) .. index:: pair: function; strCopy .. _doxid-class_e_e_1_1_string_1a82262e45def658597868a1105db4b7b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void strCopy(char* Dst, const char* Src, unsigned int DstSize) Copy a string to another .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Dst - Destination :ref:`String ` * - Src - Source :ref:`String ` * - DstSize - Destination Size .. index:: pair: function; startsWith .. _doxid-class_e_e_1_1_string_1afb1f1ba66865bf0ebd7d04b6ed436ecf: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool startsWith(const std::string& haystack, const std::string& needle) Compare two strings from its beginning. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: true if string starts with the substring .. index:: pair: function; startsWith .. _doxid-class_e_e_1_1_string_1a01dd032beaf8bcbceedbc77ad6093a86: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool startsWith(const String& haystack, const String& needle) Compare two strings from its beginning. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: true if string starts with the substring .. index:: pair: function; startsWith .. _doxid-class_e_e_1_1_string_1a371c72a60c5351fc6e2569bcdf669fb4: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool startsWith(const char* haystack, const char* needle) Compare two strings from its beginning. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: true if string starts with the substring .. index:: pair: function; endsWith .. _doxid-class_e_e_1_1_string_1a8eb1c8c2e2640fdacdb3521a32ebb077: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool endsWith(const std::string& haystack, const std::string& needle) Compare two strings from its end. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: true if string starts with the substring .. index:: pair: function; endsWith .. _doxid-class_e_e_1_1_string_1a03f623d8a67f810b0a3edcaf7161221a: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool endsWith(const String& haystack, const String& needle) Compare two strings from its end. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: true if string starts with the substring .. index:: pair: function; contains .. _doxid-class_e_e_1_1_string_1aff84b25bfd375101020e70dbbf0d65fa: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool contains(const std::string& haystack, const std::string& needle) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: True if a string contains a substring. .. index:: pair: function; contains .. _doxid-class_e_e_1_1_string_1a5b6b167a333d6984635fd46ca49a79a0: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool contains(const String& haystack, const String& needle) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - haystack - The string to search in. * - needle - The searched string. .. rubric:: Returns: True if a string contains a substring. .. index:: pair: function; replaceAll .. _doxid-class_e_e_1_1_string_1ae90612abc2e7b250a907a091c14dcc3f: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void replaceAll(std::string& target, const std::string& that, const std::string& with) Replace all occurrences of the search string with the replacement string. .. index:: pair: function; replaceAll .. _doxid-class_e_e_1_1_string_1ae71522312eec45c68c9f5b5457fbe6e8: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void replaceAll(String& target, const String& that, const String& with) Replace all occurrences of the search string with the replacement string. .. index:: pair: function; replace .. _doxid-class_e_e_1_1_string_1a227875e85bb9fd33402ef0202076c97e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void replace(std::string& target, const std::string& that, const std::string& with) Replace the first ocurrence of the search string with the replacement string. .. index:: pair: function; replace .. _doxid-class_e_e_1_1_string_1ae8d728b627fe4701f4ff5b10f3ed80f3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void replace(String& target, const String& that, const String& with) Replace the first ocurrence of the search string with the replacement string. .. index:: pair: function; removeNumbersAtEnd .. _doxid-class_e_e_1_1_string_1a3b00846d84155e4d2320f9f3c6983f0b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string removeNumbersAtEnd(std::string txt) Removes the numbers at the end of the string .. index:: pair: function; numberClean .. _doxid-class_e_e_1_1_string_1a464a4b30ea67365e2b5a0eb8c71cfe38: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string_view numberClean(std::string_view strNumber) Removes the trailing 0 and . in a string number .. index:: pair: function; numberClean .. _doxid-class_e_e_1_1_string_1a6388fc1517068962425e1755d2d6d642: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string numberClean(const std::string& strNumber) Removes the trailing 0 and . in a string number .. index:: pair: function; numberCleanInPlace .. _doxid-class_e_e_1_1_string_1a982ce55a9051b8ac58778499476028d9: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void numberCleanInPlace(std::string& strNumber) Removes the trailing 0 and . in a string number .. index:: pair: function; findCloseBracket .. _doxid-class_e_e_1_1_string_1a8ed82f2c1744490b8009440bcdf45b8d: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::size_t findCloseBracket(const std::string& string, std::size_t startOffset, char openBracket, char closeBracket) Searchs the position of the corresponding close bracket in a string. .. index:: pair: function; valueIndex .. _doxid-class_e_e_1_1_string_1a9609197d950563628c9af75109316873: .. ref-code-block:: cpp :class: doxyrest-title-code-block static int valueIndex(const std::string& val, const std::string& strings, int defValue = -1, char delim = ';') Having a string of values separated by a delimiter, returns the corresponding index of the searched value .. index:: pair: function; randString .. _doxid-class_e_e_1_1_string_1a75017c9a3458183697d13667a06009cf: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string randString(size_t len, std::string dictionary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") Creates a random string using the dictionary characters. .. index:: pair: function; toString .. _doxid-class_e_e_1_1_string_1a7906126f4c4485cf9d79a7e725108676: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static std::string toString(const T& i) Converts from any basic type to std::string .. index:: pair: function; fromString .. _doxid-class_e_e_1_1_string_1ae6dba35f1a29bf8942c7706e901a3e91: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static bool fromString(T& t, const std::string& s, std::ios_base&(*)(std::ios_base&) f = std::dec) Converts from a string to type .. index:: pair: function; fromString .. _doxid-class_e_e_1_1_string_1a963d8a2b837f3ea43cdd268c57b23f0a: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static bool fromString(T& t, const String& s, std::ios_base&(*)(std::ios_base&) f = std::dec) Converts from a :ref:`String ` to type .. index:: pair: function; formatBuffer .. _doxid-class_e_e_1_1_string_1a29e0a4bd621bba85c239a6c07211f9d2: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void formatBuffer(char* Buffer, int BufferSize, const char* format, ...) Format a char buffer .. index:: pair: function; fromUtf8 .. _doxid-class_e_e_1_1_string_1a7b249cb4fe52855599993b1ef7822663: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String fromUtf8(const std::string& utf8String) Construct from an UTF-8 string to UTF-32 according. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf8String - UTF-8 string to convert .. index:: pair: function; utf8Length .. _doxid-class_e_e_1_1_string_1a152ace0c5baf52181a1afcf0af7c70cc: .. ref-code-block:: cpp :class: doxyrest-title-code-block static size_t utf8Length(const std::string& utf8String) .. rubric:: Returns: The number of codepoints of the utf8 string. .. index:: pair: function; fromUtf8 .. _doxid-class_e_e_1_1_string_1a6019a22869fb5d86f0b004771ca00b96: .. ref-code-block:: cpp :class: doxyrest-title-code-block static String fromUtf8(const std::string_view& utf8String) Construct from an UTF-8 string to UTF-32 according. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - utf8String - UTF-8 string to convert .. index:: pair: function; utf8Length .. _doxid-class_e_e_1_1_string_1a0f31e78f106e6b698ca9f34121f55325: .. ref-code-block:: cpp :class: doxyrest-title-code-block static size_t utf8Length(const std::string_view& utf8String) .. rubric:: Returns: The number of codepoints of the utf8 string. .. index:: pair: function; utf8Next .. _doxid-class_e_e_1_1_string_1a466817a80a178587d8ee3af12c93fcf0: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`Uint32` utf8Next(char*& utf8String) .. rubric:: Returns: The next character in a utf8 null terminated string .. index:: pair: function; globMatch .. _doxid-class_e_e_1_1_string_1af6789b45b2d38244333f6c78981f105e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool globMatch(const std::string_view& text, const std::string_view& glob, bool caseInsensitive = false) glob matches a string against a glob .. rubric:: Returns: True if matches .. index:: pair: function; globMatch .. _doxid-class_e_e_1_1_string_1a3a8a6bb9f10db52e5257129421c1c28e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool globMatch(const std::string_view& text, const std::vector& globs, bool caseInsensitive = false) glob matches a string against a set of globs .. rubric:: Returns: True if matches .. index:: pair: function; fromUtf8 .. _doxid-class_e_e_1_1_string_1a122b2047610c3c6a6c06e8638f5d647f: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static String fromUtf8(T begin, T end) Create a new :ref:`String ` from a UTF-8 encoded string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Forward iterator to the begining of the UTF-8 sequence * - end - Forward iterator to the end of the UTF-8 sequence .. rubric:: Returns: A :ref:`String ` containing the source string .. rubric:: See also: FromUtf16, FromUtf32 .. index:: pair: function; fromUtf16 .. _doxid-class_e_e_1_1_string_1a5210aa5b6cb03b0f62c8fdc401cbd0d0: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static String fromUtf16(T begin, T end) Create a new :ref:`String ` from a UTF-16 encoded string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Forward iterator to the begining of the UTF-16 sequence * - end - Forward iterator to the end of the UTF-16 sequence .. rubric:: Returns: A :ref:`String ` containing the source string .. rubric:: See also: FromUtf8, FromUtf32 .. index:: pair: function; fromUtf32 .. _doxid-class_e_e_1_1_string_1a497eece30eb386acd691fa96dce5698a: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static String fromUtf32(T begin, T end) Create a new :ref:`String ` from a UTF-32 encoded string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Forward iterator to the begining of the UTF-32 sequence * - end - Forward iterator to the end of the UTF-32 sequence .. rubric:: Returns: A :ref:`String ` containing the source string .. rubric:: See also: FromUtf8, FromUtf32 .. index:: pair: function; operator std::string .. _doxid-class_e_e_1_1_string_1ad6eeb50c3b6b8d718544cec33bff9239: .. ref-code-block:: cpp :class: doxyrest-title-code-block operator std::string() const Implicit cast operator to std::string (ANSI string) The current global locale is used for conversion. If you want to explicitely specify a locale, see toAnsiString. Characters that do not fit in the target encoding are discarded from the returned string. This operator is defined for convenience, and is equivalent to calling :ref:`toAnsiString() `. .. rubric:: Returns: Converted ANSI string .. rubric:: See also: :ref:`toAnsiString `, operator :ref:`String ` .. index:: pair: function; toAnsiString .. _doxid-class_e_e_1_1_string_1ad29e55c19085fb3729eeb1adb69f0166: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string toAnsiString(const std::locale& locale = std::locale()) const Convert the unicode string to an ANSI string The UTF-32 string is converted to an ANSI string in the encoding defined by *locale*. If you want to use the current global locale, see the other overload of toAnsiString. Characters that do not fit in the target encoding are discarded from the returned string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - locale - Locale to use for conversion .. rubric:: Returns: Converted ANSI string .. rubric:: See also: :ref:`toWideString `, operator std::string .. index:: pair: function; toWideString .. _doxid-class_e_e_1_1_string_1aa1b8628e5233c8636b10c0875e9188ef: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::wstring toWideString() const Convert the unicode string to a wide string Characters that do not fit in the target encoding are discarded from the returned string. .. rubric:: Returns: Converted wide string .. rubric:: See also: :ref:`toAnsiString `, operator :ref:`String ` .. index:: pair: function; toUtf8 .. _doxid-class_e_e_1_1_string_1ab1698d1e7a2b9d21e2a1f47fc36ed368: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string toUtf8() const Convert the string to a UTF-8 string .. index:: pair: function; toUtf16 .. _doxid-class_e_e_1_1_string_1ac2ce240679c2ba6a49814bfa98e41626: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::basic_string<:ref:`Uint16`> toUtf16() const Convert the string to a UTF-16 string .. index:: pair: function; getHash .. _doxid-class_e_e_1_1_string_1ae31aa126ec209f74d83c8278ba08e648: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`HashType` getHash() const .. rubric:: Returns: The hash code of the :ref:`String ` .. index:: pair: function; operator= .. _doxid-class_e_e_1_1_string_1aa506ea7c8b30aa92d0d7490e43c64442: .. ref-code-block:: cpp :class: doxyrest-title-code-block String& operator=(const String& right) Overload of assignment operator. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - right - Instance to assign .. rubric:: Returns: Reference to self .. index:: pair: function; operator+= .. _doxid-class_e_e_1_1_string_1a92a834375785a8e1185ffec738659d9b: .. ref-code-block:: cpp :class: doxyrest-title-code-block String& operator+=(const String& right) Overload of += operator to append an UTF-32 string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - right - :ref:`String ` to append .. rubric:: Returns: Reference to self .. index:: pair: function; operator[] .. _doxid-class_e_e_1_1_string_1ab226bf1c97dbc23e742bc4d4a8c9b4e3: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`StringBaseType`& operator[](std::size_t index) const Overload of [] operator to access a character by its position This function provides read-only access to characters. Note: this function doesn't throw if *index* is out of range. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - index - Index of the character to get .. rubric:: Returns: Character at position *index* .. index:: pair: function; operator[] .. _doxid-class_e_e_1_1_string_1ae6b21b29a8404d18b2b51f44c4015aef: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`StringBaseType`& operator[](std::size_t index) Overload of [] operator to access a character by its position This function provides read and write access to characters. Note: this function doesn't throw if *index* is out of range. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - index - Index of the character to get .. rubric:: Returns: Reference to the character at position *index* .. index:: pair: function; at .. _doxid-class_e_e_1_1_string_1a434615226e7276a28e91b15bd3a0945d: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`StringBaseType`& at(std::size_t index) const Get character in string Performs a range check, throwing an exception of type out_of_range in case that pos is not an actual position in the string. .. rubric:: Returns: The character at position pos in the string. .. index:: pair: function; clear .. _doxid-class_e_e_1_1_string_1ad5f16a88667539d7944d1ae6b5af22a3: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clear() clear the string This function removes all the characters from the string. .. rubric:: See also: :ref:`empty `, :ref:`erase ` .. index:: pair: function; size .. _doxid-class_e_e_1_1_string_1af0d7e420e3bc69af80e2180cd4ce7f02: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t size() const Get the size of the string. .. rubric:: Returns: Number of characters in the string .. rubric:: See also: :ref:`empty ` .. index:: pair: function; length .. _doxid-class_e_e_1_1_string_1a71987eb3688500b59ad458546240bcb9: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t length() const .. rubric:: See also: :ref:`size() ` .. index:: pair: function; empty .. _doxid-class_e_e_1_1_string_1a8f4291dfcf066a373592a932b8b9212c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool empty() const Check whether the string is empty or not. .. rubric:: Returns: True if the string is empty (i.e. contains no character) .. rubric:: See also: :ref:`clear `, :ref:`size ` .. index:: pair: function; erase .. _doxid-class_e_e_1_1_string_1abce604264bde1ec8877ebc4a54d9c8a2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void erase(std::size_t position, std::size_t count = 1) Erase one or more characters from the string This function removes a sequence of *count* characters starting from *position*. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - position - Position of the first character to erase * - count - Number of characters to erase .. index:: pair: function; insert .. _doxid-class_e_e_1_1_string_1ae0dcc29446e752bd0a433a13e1585ed1: .. ref-code-block:: cpp :class: doxyrest-title-code-block String& insert(std::size_t position, const String& str) Insert one or more characters into the string This function inserts the characters of *str* into the string, starting from *position*. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - position - Position of insertion * - str - Characters to insert .. index:: pair: function; find .. _doxid-class_e_e_1_1_string_1a2514bd6d4d0e0fcdce3351205c6c4fd0: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t find(const String& str, std::size_t start = 0) const Find a sequence of one or more characters in the string This function searches for the characters of *str* into the string, starting from *start*. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - str - Characters to find * - start - Where to begin searching .. rubric:: Returns: Position of *str* in the string, or :ref:`String::InvalidPos ` if not found .. index:: pair: function; c_str .. _doxid-class_e_e_1_1_string_1a7edcbd94ca84eca8da41044d472d3e79: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`StringBaseType`* c_str() const Get a pointer to the C-style array of characters This functions provides a read-only access to a null-terminated C-style representation of the string. The returned pointer is temporary and is meant only for immediate use, thus it is not recommended to store it. .. rubric:: Returns: Read-only pointer to the array of characters .. index:: pair: function; data .. _doxid-class_e_e_1_1_string_1a4f2e62be34e30ae7bed6c96032ea1cef: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`StringBaseType`* data() const Get string data Notice that no terminating null character is appended (see member c_str for such a functionality). The returned array points to an internal location which should not be modified directly in the program. Its contents are guaranteed to remain unchanged only until the next call to a non-constant member function of the string object. .. rubric:: Returns: Pointer to an internal array containing the same content as the string. .. index:: pair: function; begin .. _doxid-class_e_e_1_1_string_1a44a02c1289a998903013687c4e5fe781: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Iterator` begin() Return an iterator to the beginning of the string. .. rubric:: Returns: Read-write iterator to the beginning of the string characters .. rubric:: See also: :ref:`end ` .. index:: pair: function; begin .. _doxid-class_e_e_1_1_string_1a0aefc885a5a1ced391f9ed7299680dba: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ConstIterator` begin() const Return an iterator to the beginning of the string. .. rubric:: Returns: Read-only iterator to the beginning of the string characters .. rubric:: See also: :ref:`end ` .. index:: pair: function; end .. _doxid-class_e_e_1_1_string_1a4581c38b02ef25f842e2fdf24bbaa0e4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Iterator` end() Return an iterator to the beginning of the string The end iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed. .. rubric:: Returns: Read-write iterator to the end of the string characters .. rubric:: See also: :ref:`begin ` .. index:: pair: function; end .. _doxid-class_e_e_1_1_string_1aaf1eb5f0e5e21aa0604cfe780e7eb8ab: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ConstIterator` end() const Return an iterator to the beginning of the string The end iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed. .. rubric:: Returns: Read-only iterator to the end of the string characters .. rubric:: See also: :ref:`begin ` .. index:: pair: function; rbegin .. _doxid-class_e_e_1_1_string_1aa73e721daffb5438605217ac2b9d26d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ReverseIterator` rbegin() Return an reverse iterator to the beginning of the string. .. rubric:: Returns: Read-write reverse iterator to the beginning of the string characters .. rubric:: See also: :ref:`end ` .. index:: pair: function; rbegin .. _doxid-class_e_e_1_1_string_1aecc8f29419268a6e4feed4445a510846: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ConstReverseIterator` rbegin() const Return an reverse iterator to the beginning of the string. .. rubric:: Returns: Read-only reverse iterator to the beginning of the string characters .. rubric:: See also: :ref:`end ` .. index:: pair: function; rend .. _doxid-class_e_e_1_1_string_1a8b14fa055c31eb941fd4ac698f0e8ada: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ReverseIterator` rend() Return an reverse iterator to the beginning of the string The end reverse iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed. .. rubric:: Returns: Read-write reverse iterator to the end of the string characters .. rubric:: See also: :ref:`begin ` .. index:: pair: function; rend .. _doxid-class_e_e_1_1_string_1a9b480548f7db9dad0c2bc83b37c34d29: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ConstReverseIterator` rend() const Return an reverse iterator to the beginning of the string The end reverse iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed. .. rubric:: Returns: Read-only reverse iterator to the end of the string characters .. rubric:: See also: :ref:`begin ` .. index:: pair: function; resize .. _doxid-class_e_e_1_1_string_1ae5a88b3391ce0be20686615ba83cb0a8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void resize(std::size_t n, :ref:`StringBaseType` c) Resize :ref:`String `. .. index:: pair: function; resize .. _doxid-class_e_e_1_1_string_1ac90225b86bfc6b30fd8bf57dea541fa5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void resize(std::size_t n) Resize :ref:`String `. .. index:: pair: function; max_size .. _doxid-class_e_e_1_1_string_1aa6435b6d8371c2e1b92a68895fbaba86: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t max_size() const .. rubric:: Returns: Maximum size of string .. index:: pair: function; reserve .. _doxid-class_e_e_1_1_string_1a7eff1457f91559e4dd1847fc36819f3f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void reserve(size_t res_arg = 0) Request a change in capacity. .. index:: pair: function; capacity .. _doxid-class_e_e_1_1_string_1ade22b053309a6528562894f641e73244: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t capacity() const .. rubric:: Returns: Size of allocated storage .. index:: pair: function; push_back .. _doxid-class_e_e_1_1_string_1ae33b2080b73aecefce5ff705c73776e9: .. ref-code-block:: cpp :class: doxyrest-title-code-block void push_back(:ref:`StringBaseType` c) Append character to string. .. index:: pair: function; swap .. _doxid-class_e_e_1_1_string_1a1ca4b3f2c1210dc05e2d9e8e3edcd97b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void swap(String& str) Swap contents with another string. .. index:: pair: function; replaceAll .. _doxid-class_e_e_1_1_string_1a396c2a592075fee405a4b18d1303edad: .. ref-code-block:: cpp :class: doxyrest-title-code-block void replaceAll(const String& that, const String& with) Replace all occurrences of the search string with the replacement string. .. index:: pair: function; contains .. _doxid-class_e_e_1_1_string_1afb03a816f73ee4ff4e5bb5d07b34f997: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool contains(const String& needle) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - needle - The searched string. .. rubric:: Returns: True if a string contains a substring. .. index:: pair: function; operator== .. _doxid-class_e_e_1_1_string_1aa7765e8bb417e7be78e698da13499789: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator==(const String& left, const String& right) Overload of == operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if both strings are equal .. index:: pair: function; operator!= .. _doxid-class_e_e_1_1_string_1adff152c3bb9ce002b2ecda407ccadbce: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator!=(const String& left, const String& right) Overload of != operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if both strings are different .. index:: pair: function; operator< .. _doxid-class_e_e_1_1_string_1a3dd295590c7769c69e3ce60d3bdeefb4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator<(const String& left, const String& right) Overload of < operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if *left* is alphabetically lesser than *right* .. index:: pair: function; operator> .. _doxid-class_e_e_1_1_string_1aa3feb4316dd90148f97edf990e87002c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator>(const String& left, const String& right) Overload of > operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if *left* is alphabetically greater than *right* .. index:: pair: function; operator<= .. _doxid-class_e_e_1_1_string_1a6e531f931b62a280a00499e62530e31c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator<=(const String& left, const String& right) Overload of <= operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if *left* is alphabetically lesser or equal than *right* .. index:: pair: function; operator>= .. _doxid-class_e_e_1_1_string_1a48c73fed7b109332c1ad24438632824a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` bool operator>=(const String& left, const String& right) Overload of >= operator to compare two UTF-32 strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: True if *left* is alphabetically greater or equal than *right* .. index:: pair: function; operator+ .. _doxid-class_e_e_1_1_string_1a5bcda8eca28b64cd3ca8833ba9caa5c9: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EE_API` String operator+(const String& left, const String& right) Overload of binary + operator to concatenate two strings. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - left - Left operand (a string) * - right - Right operand (a string) .. rubric:: Returns: Concatenated string