String class used across the library. Is a substitute for C# System.String when translating code. For optimization reasons, isn't considered an Object subclass. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type. More...

Public Types

using reverse_iterator = std::reverse_iterator< const char16_t * >
 Reverse iterator type. More...
 

Public Member Functions

ASPOSECPP_SHARED_API String ()
 Default constructor. Creates string object which is considered null. More...
 
template<typename T >
 String (T &value, typename std::enable_if< IsStringLiteral< T, char16_t >::value >::type *=nullptr)
 Constructs string based on string literal. Considers literal a null-terminated string, calculates target string length based on literal size. More...
 
template<typename T >
 String (const T &value, typename std::enable_if< IsStringPointer< T, char16_t >::value >::type *=nullptr)
 Constructs string based on character string pointer. Treats pointed string as null-terminated, calculates target string length based on null character. More...
 
template<typename T >
 String (T &value, typename std::enable_if< IsStringLiteral< T, char >::value >::type *=nullptr)
 Constructs string based on string literal. Considers literal a null-terminated string in UTF8, calculates target string length based on literal size. More...
 
template<typename T >
 String (const T &value, typename std::enable_if< IsStringPointer< T, char >::value >::type *=nullptr)
 Constructs string based on character string pointer. Treats pointed string as null-terminated in UTF8, calculates target string length based on null character. More...
 
ASPOSECPP_SHARED_API String (const char16_t *str, int length)
 Constructs string from character string pointer and explicit length. More...
 
ASPOSECPP_SHARED_API String (const char *str, int length)
 Constructs string from character string pointer and explicit length. More...
 
ASPOSECPP_SHARED_API String (const char16_t *str, int start, int length)
 Constructs string from character string pointer from starting position using length. More...
 
ASPOSECPP_SHARED_API String (const char16_t ch, int count)
 Fill constructor. More...
 
template<typename T >
 String (const T &value, typename std::enable_if< std::is_same< T, std::nullptr_t >::value >::type *=nullptr)
 Nullptr constructor. Declared as template to resolve priorities with other template constructors. More...
 
template<typename T >
 String (T &value, typename std::enable_if< IsStringLiteral< T, wchar_t >::value >::type *=nullptr)
 Constructs string based on widestring literal. Considers literal a null-terminated string, calculates target string length based on literal size. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed. More...
 
template<typename T >
 String (const T &value, typename std::enable_if< IsStringPointer< T, wchar_t >::value >::type *=nullptr)
 Constructs string based on widecharacter string pointer. Treats pointed string as null-terminated, calculates target string length based on null character. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed. More...
 
ASPOSECPP_SHARED_API String (const wchar_t *str, int length)
 Constructs string from widecharacter string pointer and explicit length. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed. More...
 
ASPOSECPP_SHARED_API String (const wchar_t ch, int count=1)
 Fill constructor. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed. More...
 
ASPOSECPP_SHARED_API String (const String &str)
 Copy constructor. More...
 
ASPOSECPP_SHARED_API String (String &&str) noexcept
 Move constructor. More...
 
ASPOSECPP_SHARED_API String (const ArrayPtr< char16_t > &arr)
 Converts whole character array to string. More...
 
ASPOSECPP_SHARED_API String (const ArrayPtr< char16_t > &arr, int offset, int len)
 Converts character array subrange to string. If parameters are out of array bounds, empty string is constructed. More...
 
ASPOSECPP_SHARED_API ~String ()
 Destructor. More...
 
ASPOSECPP_SHARED_API const UChar * u_str () const
 Returns ICU-styled null-terminated buffer. May reallocate the string. More...
 
ASPOSECPP_SHARED_API const UChar * begin () const
 Returns pointer to the beginning of actual string buffer. Never reallocates anything. Doesn't guarantee buffer to be null-terminated. More...
 
ASPOSECPP_SHARED_API const UChar * end () const
 Returns pointer to the end of actual string buffer. Never reallocates anything. Doesn't guarantee buffer to be null-terminated. More...
 
ASPOSECPP_SHARED_API reverse_iterator rbegin () const
 Returns reverse iterator to the last character (if any) of actual string buffer. More...
 
ASPOSECPP_SHARED_API reverse_iterator rend () const
 Returns reverse iterator to the before first character (if any) of actual string buffer. More...
 
ASPOSECPP_SHARED_API bool IsNullOrEmpty () const
 Checks if string is empty or is considered null. More...
 
bool IsNull () const
 Checks if string is considered null. String is null and only if it is constructed via String() constructor, moved, copied or assigned from null string or reset() method was called. More...
 
ASPOSECPP_SHARED_API bool IsEmpty () const
 Checks if string is both non-null and empty. More...
 
ASPOSECPP_SHARED_API std::string ToUtf8String () const
 Converts string to std::string. Uses UTF-8 encoding. More...
 
ASPOSECPP_SHARED_API std::wstring ToWCS () const
 Converts string to std::wstring. More...
 
ASPOSECPP_SHARED_API std::u16string ToU16Str () const
 Converts string to std::u16string. More...
 
ASPOSECPP_SHARED_API std::u32string ToU32Str () const
 Converts string to std::u32string. More...
 
ASPOSECPP_SHARED_API std::string ToAsciiString () const
 Converts string to std::string. Uses ASCII encoding. More...
 
ASPOSECPP_SHARED_API Stringreset ()
 Sets string to null. Is analogous to 'string_variable_name = null' in C#. More...
 
ASPOSECPP_SHARED_API int get_Length () const
 Gets string length. More...
 
ASPOSECPP_SHARED_API char_t operator[] (int index) const
 Gets character at specified position. More...
 
ASPOSECPP_SHARED_API StringSetCharAt (int index, char_t ch)
 Sets character at specified position. More...
 
ASPOSECPP_SHARED_API Stringoperator= (const String &str)
 Assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator= (String &&str) noexcept
 Move assignment operator. More...
 
ASPOSECPP_SHARED_API String operator+ (const String &str) const
 String concatenation operator. More...
 
template<typename T , std::enable_if_t< IsStringLiteral< T, char_t >::value > * = nullptr>
String operator+ (const T &arg) const
 String concatenation with string literal or character string pointer. More...
 
ASPOSECPP_SHARED_API String operator+ (char_t x) const
 Adds character to the end of the string. More...
 
ASPOSECPP_SHARED_API String operator+ (int i) const
 Adds integer value string representation to the end of the string. More...
 
ASPOSECPP_SHARED_API String operator+ (uint32_t i) const
 Adds unsigned integer value string representation to the end of the string. More...
 
ASPOSECPP_SHARED_API String operator+ (double d) const
 Adds floating point value string representation to the end of the string. More...
 
ASPOSECPP_SHARED_API String operator+ (int64_t v) const
 Adds integer value string representation to the end of the string. More...
 
template<typename T , std::enable_if_t< IsSmartPtr< T >::value > * = nullptr>
String operator+ (const T &value) const
 Adds reference type object string representation to the end of the string. More...
 
template<typename T , std::enable_if_t<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!std::is_array< T >::value > * = nullptr>
String operator+ (const T &value) const
 Adds value type object string representation to the end of the string. More...
 
template<typename T , std::enable_if_t< std::is_same< T, bool >::value > * = nullptr>
String operator+ (T arg) const
 Adds boolean value string representation to the end of the string. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (char_t c)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (const String &str)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (double value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (uint8_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (int16_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (uint16_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (int32_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (uint32_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (int64_t value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API Stringoperator+= (uint64_t value)
 Concatenation assignment operator. More...
 
template<typename T , std::enable_if_t< std::is_same< T, bool >::value > * = nullptr>
Stringoperator+= (T value)
 Concatenation assignment operator. More...
 
ASPOSECPP_SHARED_API bool operator== (const String &str) const
 Equality comparison operator. More...
 
ASPOSECPP_SHARED_API bool operator== (std::nullptr_t) const
 Checks if string is null. Applies same logic as IsNull() call. More...
 
ASPOSECPP_SHARED_API bool operator!= (const String &str) const
 Non-equality comparison operator. More...
 
ASPOSECPP_SHARED_API bool operator!= (std::nullptr_t) const
 Checks if string is not null. Applies same logic as IsNull() call. More...
 
ASPOSECPP_SHARED_API bool operator< (const String &str) const
 Order-compares strings. More...
 
ASPOSECPP_SHARED_API String Clone () const
 Creates a copy of current string. More...
 
String ToString () const
 Wrapper for handling String class in contexts where ToString() is being called on value type objects. More...
 
String ToString (const SharedPtr< IFormatProvider > &) const
 Wrapper for handling String class in contexts where ToString() is being called on value type objects. More...
 
ASPOSECPP_SHARED_API int GetHashCode () const
 Hashes contained string. Implemented in ICU, doesn't match hashes in C#. More...
 
ASPOSECPP_SHARED_API bool Equals (const String &str, System::StringComparison comparison_type) const
 String equality comparison. Several modes provided by StringComparison enumeration are supported. More...
 
ASPOSECPP_SHARED_API bool Equals (const String &str) const
 String equality comparison. Uses System::StringComparison::Ordinal comparison mode. More...
 
ASPOSECPP_SHARED_API bool Contains (const String &str) const
 Checks if str is a substring of current string. More...
 
ASPOSECPP_SHARED_API int CompareTo (const String &str) const
 Compares two strings in 'less-equals-more' style. Uses current culture. More...
 
ASPOSECPP_SHARED_API void CopyTo (int sourceIndex, const ArrayPtr< char_t > &destination, int destinationIndex, int count) const
 Copies string characters into existing array elements. No resize is being done. More...
 
ASPOSECPP_SHARED_API String Normalize (System::Text::NormalizationForm form) const
 Normalizes unicode string using normalization form specified. More...
 
ASPOSECPP_SHARED_API bool IsNormalized (System::Text::NormalizationForm form) const
 Checks if unicode string is normalized using normalization form specified. More...
 
ASPOSECPP_SHARED_API bool StartsWith (const String &value) const
 Checks if string begins with specified substring. More...
 
ASPOSECPP_SHARED_API bool StartsWith (const String &value, System::StringComparison comparisonType) const
 Checks if string begins with specified substring. More...
 
ASPOSECPP_SHARED_API bool StartsWith (const String &value, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &culture=nullptr) const
 Checks if string begins with specified substring. More...
 
ASPOSECPP_SHARED_API bool EndsWith (const String &value) const
 Checks if string ends with specified substring. More...
 
ASPOSECPP_SHARED_API bool EndsWith (const String &value, System::StringComparison comparisonType) const
 Checks if string ends with specified substring. More...
 
ASPOSECPP_SHARED_API bool EndsWith (const String &value, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &culture=nullptr) const
 Checks if string ends with specified substring. More...
 
ASPOSECPP_SHARED_API ArrayPtr< char_t > ToCharArray (int32_t startIndex=0, int32_t length=INT32_MAX) const
 Converts string or substring to array of characters. More...
 
ASPOSECPP_SHARED_API ArrayPtr< uint8_t > ToByteArray (int32_t startIndex=0, int32_t length=INT32_MAX, bool LE=true) const
 Converts string or substring to array of bytes. More...
 
ASPOSECPP_SHARED_API String ToUpper () const
 Converts all string's characters to upper case. More...
 
ASPOSECPP_SHARED_API String ToLower () const
 Converts all string's characters to lower case. More...
 
ASPOSECPP_SHARED_API String ToLower (const SharedPtr< System::Globalization::CultureInfo > &cultureInfo) const
 Converts all string's characters to lower case using specific culture. More...
 
ASPOSECPP_SHARED_API String ToUpper (const SharedPtr< System::Globalization::CultureInfo > &cultureInfo) const
 Converts all string's characters to upper case using specific culture. More...
 
ASPOSECPP_SHARED_API String ToUpperInvariant () const
 Converts all string's characters to upper case using invariant culture. More...
 
ASPOSECPP_SHARED_API String ToLowerInvariant () const
 Converts all string's characters to lower case using invariant culture. More...
 
ASPOSECPP_SHARED_API String Substring (int32_t startIndex) const
 Extracts substring. More...
 
ASPOSECPP_SHARED_API String Substring (int32_t startIndex, int32_t length) const
 Extracts substring. More...
 
ASPOSECPP_SHARED_API String Remove (int32_t startIndex, int32_t count=INT32_MAX) const
 Extracts everything but substring from current string. More...
 
bool Is (const System::TypeInfo &target) const
 Checks if string object is of type specified by TypeInfo passed. More...
 
ASPOSECPP_SHARED_API int IndexOf (const String &str, System::StringComparison comparison_type) const
 Substring forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOf (char_t c, int startIndex=0) const
 Character forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOf (char_t c, int startIndex, int count) const
 Character forward lookup in substring. More...
 
ASPOSECPP_SHARED_API int IndexOf (const String &str, int startIndex=0) const
 Substring forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOf (const String &str, int startIndex, System::StringComparison comparison_type) const
 Substring forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOf (const String &value, int startIndex, int count, System::StringComparison comparisonType) const
 Substring forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOf (const String &str, int startIndex, int count) const
 Substring forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOfAny (char_t c, int startIndex=0) const
 Character forward lookup. More...
 
ASPOSECPP_SHARED_API int IndexOfAny (const String &str, int startIndex=0) const
 Consequently looks for all characters of str in this. If first character is found, its position is returned, otherwise looks for the second one and so on. More...
 
ASPOSECPP_SHARED_API int IndexOfAny (const ArrayPtr< char_t > &anyOf) const
 Looks for any of passed characters through the whole string. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters. More...
 
ASPOSECPP_SHARED_API int IndexOfAny (const ArrayPtr< char_t > &anyOf, int32_t startindex) const
 Looks for any of passed characters through substring. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters. More...
 
ASPOSECPP_SHARED_API int IndexOfAny (const ArrayPtr< char_t > &anyOf, int32_t startindex, int32_t count) const
 Looks for any of passed characters through substring. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (const String &str, int startIndex=INT32_MAX) const
 Substring backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (const String &str, System::StringComparison comparison_type) const
 Substring backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (const String &str, int startIndex, System::StringComparison comparison_type) const
 Substring backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (const String &value, int startIndex, int count, StringComparison comparisonType) const
 Substring backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (char_t value) const
 Character backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (char_t value, int32_t startIndex) const
 Character backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOf (char_t value, int32_t startIndex, int32_t count) const
 Character backward lookup. More...
 
ASPOSECPP_SHARED_API int LastIndexOfAny (const ArrayPtr< char_t > &anyOf) const
 Looks for any of passed characters through whole string backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found. More...
 
ASPOSECPP_SHARED_API int LastIndexOfAny (const ArrayPtr< char_t > &anyOf, int32_t startindex) const
 Looks for any of passed characters through substring backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found. More...
 
ASPOSECPP_SHARED_API int LastIndexOfAny (const ArrayPtr< char_t > &anyOf, int32_t startindex, int32_t count) const
 Looks for any of passed characters through substring backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found. More...
 
ASPOSECPP_SHARED_API String Trim () const
 Removes all whitespace characters from both beginning and end of the string. More...
 
ASPOSECPP_SHARED_API String Trim (char_t ch) const
 Removes all occurrences of passed character from both beginning and end of the string. More...
 
ASPOSECPP_SHARED_API String Trim (const String &anyOf) const
 Removes all occurrences of passed characters from both beginning and end of the string. More...
 
ASPOSECPP_SHARED_API String Trim (const ArrayPtr< char_t > &anyOf) const
 Removes all occurrences of passed characters from both beginning and end of the string. More...
 
ASPOSECPP_SHARED_API String TrimStart () const
 Removes all whitespace characters from beginning of the string. More...
 
ASPOSECPP_SHARED_API String TrimStart (char_t ch) const
 Removes all occurrences of passed character from beginning of the string. More...
 
ASPOSECPP_SHARED_API String TrimStart (const String &anyOf) const
 Removes all occurrences of passed characters from beginning of the string. More...
 
ASPOSECPP_SHARED_API String TrimStart (const ArrayPtr< char_t > &anyOf) const
 Removes all occurrences of passed characters from beginning of the string. More...
 
ASPOSECPP_SHARED_API String TrimEnd () const
 Removes all whitespace characters from end of the string. More...
 
ASPOSECPP_SHARED_API String TrimEnd (char_t ch) const
 Removes all occurrences of passed character from end of the string. More...
 
ASPOSECPP_SHARED_API String TrimEnd (const String &anyOf) const
 Removes all occurrences of passed characters from end of the string. More...
 
ASPOSECPP_SHARED_API String TrimEnd (const ArrayPtr< char_t > &anyOf) const
 Removes all occurrences of passed characters from end of the string. More...
 
ASPOSECPP_SHARED_API String PadLeft (int totalWidth, char_t c=u' ') const
 Adds padding on the left of original string. More...
 
ASPOSECPP_SHARED_API String PadRight (int totalWidth, char_t c=u' ') const
 Adds padding on the right of original string. More...
 
ASPOSECPP_SHARED_API String Replace (char_t oldValue, char_t newValue) const
 Replaces all occurrences of character in the string. More...
 
ASPOSECPP_SHARED_API String Replace (const String &oldValue, const String &newValue) const
 Replaces all occurrences of lookup in this string. More...
 
ASPOSECPP_SHARED_API String Insert (int startIndex, const String &value) const
 Inserts substring at specified position. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (char_t separator=u' ', StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by character. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (char_t separator, int32_t count, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by character. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (char_t separatorA, char_t separatorB, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by one of two characters. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const ArrayPtr< char_t > &separators, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by one of characters specified. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const ArrayPtr< char_t > &separators, int32_t count, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by one of characters specified. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const String &separator, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by substring. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const String &separator, int count, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by substring. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const ArrayPtr< String > &separators, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by substring. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringSplit (const ArrayPtr< String > &separators, int count, StringSplitOptions opt=StringSplitOptions::None) const
 Splits string by substring. Currently, only supports separators array of zero or one elements. More...
 
ASPOSECPP_SHARED_API String (const codeporting_icu::UnicodeString &str)
 Wraps UnicodeString into String. More...
 
ASPOSECPP_SHARED_API String (codeporting_icu::UnicodeString &&str) noexcept
 Move constructor. More...
 
 String (const std::wstring &str)
 Creates String from widestring. More...
 
 String (const std::u16string &str)
 Creates String from utf16 string. More...
 
ASPOSECPP_SHARED_API String (const std::string &utf8str)
 Creates String from std::string string presented in format UTF-8. More...
 
ASPOSECPP_SHARED_API String (const std::u32string &u32str)
 Creates String from std::u32string string. More...
 
bool ASPOSECPP_SHARED_API IsAsciiString () const
 Indicates if a String contains ASCII symbols only. More...
 
int ASPOSECPP_SHARED_API FastToAscii (char buffer[], int buffer_size) const
 Tries to convert a String to an ASCII string. More...
 

Static Public Member Functions

static ASPOSECPP_SHARED_API bool IsNullOrEmpty (const String &str)
 Checks if passed string is null or empty. More...
 
static ASPOSECPP_SHARED_API bool IsNullOrWhiteSpace (const String &str)
 Indicates whether a specified string is null, empty, or consists only of white-space characters. More...
 
static ASPOSECPP_SHARED_API bool Equals (const String &strA, const String &strB)
 Equal-compares two strings using Ordial comparison mode. More...
 
static ASPOSECPP_SHARED_API bool Equals (const String &strA, const String &strB, System::StringComparison comparison_type)
 Equal-compares two strings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase=false)
 Less-equal-greater-compares two substrings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &ci)
 Less-equal-greater-compares two substrings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, const String &strB, System::StringComparison comparison_type)
 Less-equal-greater-compares two strings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, int indexA, const String &strB, int indexB, int length, System::StringComparison comparison_type)
 Less-equal-greater-compares two strings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, const String &strB, bool ignoreCase=false)
 Less-equal-greater-compares two strings. More...
 
static ASPOSECPP_SHARED_API int Compare (const String &strA, const String &strB, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &ci)
 Less-equal-greater-compares two strings. More...
 
static ASPOSECPP_SHARED_API int CompareOrdinal (const String &strA, const String &strB)
 Less-equal-greater-compares two strings using ordinal mode. More...
 
static ASPOSECPP_SHARED_API int CompareOrdinal (const String &strA, int indexA, const String &strB, int indexB, int length)
 Less-equal-greater-compares two strings using ordinal mode. More...
 
static ASPOSECPP_SHARED_API String Join (const String &separator, const ArrayPtr< String > &parts, int startIndex=0, int count=-1)
 Joins array using string as separator. More...
 
static ASPOSECPP_SHARED_API String Join (const String &separator, const System::Details::ArrayView< String > &parts, int startIndex=0, int count=-1)
 Joins array using string as separator. More...
 
static ASPOSECPP_SHARED_API String Join (const String &separator, const SharedPtr< System::Collections::Generic::IEnumerable< String > > &parts)
 Joins array using string as separator. More...
 
static ASPOSECPP_SHARED_API String Join (const String &separator, const ArrayPtr< SharedPtr< Object >> &parts)
 Joins array using string as separator. More...
 
static ASPOSECPP_SHARED_API String Concat (const ArrayPtr< String > &parts)
 Concatenates strings. More...
 
static ASPOSECPP_SHARED_API String Concat (const String &str0, const String &str1)
 Concatenates strings. More...
 
static ASPOSECPP_SHARED_API String Concat (const String &str0, const String &str1, const String &str2)
 Concatenates strings. More...
 
static ASPOSECPP_SHARED_API String Concat (const String &str0, const String &str1, const String &str2, const String &str3)
 Concatenates strings. More...
 
static String Copy (const String &str)
 Creates string copy. More...
 
template<class... Args>
static String Format (const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
 Formats string in C# style. More...
 
template<class... Args>
static String Format (std::nullptr_t, const String &format, const Args &... args)
 Formats string in C# style. More...
 
template<std::size_t N, class... Args>
static String Format (std::nullptr_t, const char16_t(&format)[N], const Args &... args)
 Formats string in C# style. More...
 
template<class... Args>
static String Format (const String &format, const Args &... args)
 Formats string in C# style. More...
 
template<class T >
static String Format (const String &format, const System::ArrayPtr< T > &args)
 Formats string in C# style. More...
 
static ASPOSECPP_SHARED_API String FromUtf8 (const char *utf8)
 Creates String from utf8 string. More...
 
static ASPOSECPP_SHARED_API String FromUtf8 (const char *utf8, int len)
 Creates String from utf8 string. More...
 
static ASPOSECPP_SHARED_API String FromUtf8 (const uint8_t *utf8)
 Creates String from utf8 string. More...
 
static ASPOSECPP_SHARED_API String FromUtf8 (const std::string &utf8)
 Creates String from utf8 string. More...
 
static ASPOSECPP_SHARED_API String FromWCS (const std::wstring &wcs)
 Creates String from widestring. More...
 
static ASPOSECPP_SHARED_API String FromUtf32 (const uint32_t *utf32, int32_t length)
 Creates String from utf32 string. More...
 
static ASPOSECPP_SHARED_API String FromUtf16 (const std::u16string &u16str)
 Creates String from utf16 string. More...
 
static ASPOSECPP_SHARED_API String FromAscii (const char *asciiStr)
 Creates String from ASCII string. More...
 
static ASPOSECPP_SHARED_API String FromAscii (const char *asciiStr, int len)
 Creates String from ASCII string. More...
 
static ASPOSECPP_SHARED_API String FromAscii (const std::string &asciiStr)
 Creates String from ASCII string. More...
 

Static Public Attributes

static const ASPOSECPP_SHARED_API String Empty
 Empty string. More...
 
static const ASPOSECPP_SHARED_API String Null
 Null string. More...
 

Protected Member Functions

ASPOSECPP_SHARED_API StringAppend (const char16_t *src, int32_t startIndex, int32_t count)
 Puts some characters into string. Changes string size. More...
 

Protected Attributes

Detail::UnicodeStringHolder m_str
 Actual string value. More...
 
uintptr_t m_state
 String state. Contains value 0 if string is null, 1 if string is constructed from string literal. More...
 

Detailed Description

String class used across the library. Is a substitute for C# System.String when translating code. For optimization reasons, isn't considered an Object subclass. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

#include "system/string.h"
#include <iostream>
int main()
{
// Construct a string from the array of characters and print it.
const auto chars = {u'h', u'e', u'l', u'l', u'o'};
const System::String string1(chars);
std::cout << string1 << std::endl;
// Construct a string from the array of bytes and print it.
const uint8_t bytes[] = {0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0};
const auto string2 = System::String::FromUtf8(bytes);
std::cout << string2 << std::endl;
// Trim the string below and print it.
const System::String string3(u" This string contains whitespaces in the beginning and at the end. ");
std::cout << '"' << string3.Trim() << '"' << std::endl;
// Print the number of words in the .
std::cout << "Number of words: " << string3.Trim().Split(' ')->get_Length() << std::endl;
return 0;
}
/*
This code example produces the following output:
hello
world
"This string contains whitespaces in the beginning and at the end."
Number of words: 11
*/

Member Typedef Documentation

◆ reverse_iterator

using System::String::reverse_iterator = std::reverse_iterator<const char16_t*>

Reverse iterator type.

Constructor & Destructor Documentation

◆ String() [1/24]

ASPOSECPP_SHARED_API System::String::String ( )

Default constructor. Creates string object which is considered null.

◆ String() [2/24]

template<typename T >
System::String::String ( T &  value,
typename std::enable_if< IsStringLiteral< T, char16_t >::value >::type *  = nullptr 
)
inline

Constructs string based on string literal. Considers literal a null-terminated string, calculates target string length based on literal size.

Parameters
valueString literal pointer.

◆ String() [3/24]

template<typename T >
System::String::String ( const T &  value,
typename std::enable_if< IsStringPointer< T, char16_t >::value >::type *  = nullptr 
)
inline

Constructs string based on character string pointer. Treats pointed string as null-terminated, calculates target string length based on null character.

Parameters
valueCharacter string pointer.

◆ String() [4/24]

template<typename T >
System::String::String ( T &  value,
typename std::enable_if< IsStringLiteral< T, char >::value >::type *  = nullptr 
)
inlineexplicit

Constructs string based on string literal. Considers literal a null-terminated string in UTF8, calculates target string length based on literal size.

Parameters
valueString literal pointer.

◆ String() [5/24]

template<typename T >
System::String::String ( const T &  value,
typename std::enable_if< IsStringPointer< T, char >::value >::type *  = nullptr 
)
inlineexplicit

Constructs string based on character string pointer. Treats pointed string as null-terminated in UTF8, calculates target string length based on null character.

Parameters
valueCharacter string pointer.

◆ String() [6/24]

ASPOSECPP_SHARED_API System::String::String ( const char16_t *  str,
int  length 
)

Constructs string from character string pointer and explicit length.

Parameters
strString pointer, may be literal or array.
lengthExplicit string length

◆ String() [7/24]

ASPOSECPP_SHARED_API System::String::String ( const char *  str,
int  length 
)

Constructs string from character string pointer and explicit length.

Parameters
strString pointer to the UTF8 data, may be literal or array.
lengthExplicit string length

◆ String() [8/24]

ASPOSECPP_SHARED_API System::String::String ( const char16_t *  str,
int  start,
int  length 
)

Constructs string from character string pointer from starting position using length.

Parameters
strString pointer, may be literal or array.
startStarting position.
lengthString length.

◆ String() [9/24]

ASPOSECPP_SHARED_API System::String::String ( const char16_t  ch,
int  count 
)
explicit

Fill constructor.

Parameters
chFill character.
countTarget length.

◆ String() [10/24]

template<typename T >
System::String::String ( const T &  value,
typename std::enable_if< std::is_same< T, std::nullptr_t >::value >::type *  = nullptr 
)
inline

Nullptr constructor. Declared as template to resolve priorities with other template constructors.

Template Parameters
TShould be nullptr_t
Parameters
valuenullptr

◆ String() [11/24]

template<typename T >
System::String::String ( T &  value,
typename std::enable_if< IsStringLiteral< T, wchar_t >::value >::type *  = nullptr 
)
inlineexplicit

Constructs string based on widestring literal. Considers literal a null-terminated string, calculates target string length based on literal size. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed.

Parameters
valueString literal pointer.

◆ String() [12/24]

template<typename T >
System::String::String ( const T &  value,
typename std::enable_if< IsStringPointer< T, wchar_t >::value >::type *  = nullptr 
)
inlineexplicit

Constructs string based on widecharacter string pointer. Treats pointed string as null-terminated, calculates target string length based on null character. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed.

Parameters
valueCharacter string pointer.

◆ String() [13/24]

ASPOSECPP_SHARED_API System::String::String ( const wchar_t *  str,
int  length 
)
explicit

Constructs string from widecharacter string pointer and explicit length. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed.

Parameters
strString pointer, may be literal or array.
lengthExplicit string length

◆ String() [14/24]

ASPOSECPP_SHARED_API System::String::String ( const wchar_t  ch,
int  count = 1 
)
explicit

Fill constructor. Conversion from wchar_t is time-consuming on some platforms, so no implicit conversions are allowed.

Parameters
chFill character.
countTarget length.

◆ String() [15/24]

ASPOSECPP_SHARED_API System::String::String ( const String str)

Copy constructor.

Parameters
strString to copy.

◆ String() [16/24]

ASPOSECPP_SHARED_API System::String::String ( String &&  str)
noexcept

Move constructor.

Parameters
strString to move data from.

◆ String() [17/24]

ASPOSECPP_SHARED_API System::String::String ( const ArrayPtr< char16_t > &  arr)

Converts whole character array to string.

Parameters
arrArray to convert to string.

◆ String() [18/24]

ASPOSECPP_SHARED_API System::String::String ( const ArrayPtr< char16_t > &  arr,
int  offset,
int  len 
)

Converts character array subrange to string. If parameters are out of array bounds, empty string is constructed.

Parameters
arrCharacter array.
offsetSubarray start index.
lenSubarray length.

◆ ~String()

ASPOSECPP_SHARED_API System::String::~String ( )

Destructor.

◆ String() [19/24]

ASPOSECPP_SHARED_API System::String::String ( const codeporting_icu::UnicodeString &  str)
explicit

Wraps UnicodeString into String.

Parameters
strUnicodeString to wrap into String.

◆ String() [20/24]

ASPOSECPP_SHARED_API System::String::String ( codeporting_icu::UnicodeString &&  str)
explicitnoexcept

Move constructor.

Parameters
strUnicodeString to wrap into String.

◆ String() [21/24]

System::String::String ( const std::wstring &  str)
inlineexplicit

Creates String from widestring.

Parameters
strWidestring to convert into String.

◆ String() [22/24]

System::String::String ( const std::u16string &  str)
inlineexplicit

Creates String from utf16 string.

Parameters
strUtf16 string to convert into String.

◆ String() [23/24]

ASPOSECPP_SHARED_API System::String::String ( const std::string &  utf8str)
explicit

Creates String from std::string string presented in format UTF-8.

Parameters
utf8strstd::string string to convert into String.

◆ String() [24/24]

ASPOSECPP_SHARED_API System::String::String ( const std::u32string &  u32str)
explicit

Creates String from std::u32string string.

Parameters
u32strstd::u32string string to convert into String.

Member Function Documentation

◆ Append()

ASPOSECPP_SHARED_API String& System::String::Append ( const char16_t *  src,
int32_t  startIndex,
int32_t  count 
)
protected

Puts some characters into string. Changes string size.

Parameters
srcPointer to string to insert.
startIndexIndex to start insertion at.
countNumber of characters to insert.

◆ begin()

ASPOSECPP_SHARED_API const UChar* System::String::begin ( ) const

Returns pointer to the beginning of actual string buffer. Never reallocates anything. Doesn't guarantee buffer to be null-terminated.

Returns
Pointer to actual string buffer, null-terminated or not.

◆ Clone()

ASPOSECPP_SHARED_API String System::String::Clone ( ) const

Creates a copy of current string.

Returns
Full copy of current string which is never null.

◆ Compare() [1/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
int  indexA,
const String strB,
int  indexB,
int  length,
bool  ignoreCase = false 
)
static

Less-equal-greater-compares two substrings.

Parameters
strAFirst string to compare.
indexABeginning of first string substring.
strBSecond string to compare.
indexBBeginning of the second string substring.
lengthNumber of characters to compare.
ignoreCaseSpecifies whether comparison is case-insensitive.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ Compare() [2/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
int  indexA,
const String strB,
int  indexB,
int  length,
bool  ignoreCase,
const SharedPtr< System::Globalization::CultureInfo > &  ci 
)
static

Less-equal-greater-compares two substrings.

Parameters
strAFirst string to compare.
indexABeginning of first string substring.
strBSecond string to compare.
indexBBeginning of the second string substring.
lengthNumber of characters to compare.
ignoreCaseSpecifies whether comparison is case-insensitive.
ciCulture to use for comparison.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ Compare() [3/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
const String strB,
System::StringComparison  comparison_type 
)
static

Less-equal-greater-compares two strings.

Parameters
strAFirst string to compare.
strBSecond string to compare.
comparison_typeComparison mode.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ Compare() [4/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
int  indexA,
const String strB,
int  indexB,
int  length,
System::StringComparison  comparison_type 
)
static

Less-equal-greater-compares two strings.

Parameters
strAFirst string to compare.
indexABeginning of first string substring.
strBSecond string to compare.
indexBBeginning of the second string substring.
lengthNumber of characters to compare.
comparison_typeComparison mode.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ Compare() [5/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
const String strB,
bool  ignoreCase = false 
)
static

Less-equal-greater-compares two strings.

Parameters
strAFirst string to compare.
strBSecond string to compare.
ignoreCaseSpecifies whether comparison is case-insensitive.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ Compare() [6/6]

static ASPOSECPP_SHARED_API int System::String::Compare ( const String strA,
const String strB,
bool  ignoreCase,
const SharedPtr< System::Globalization::CultureInfo > &  ci 
)
static

Less-equal-greater-compares two strings.

Parameters
strAFirst string to compare.
strBSecond string to compare.
ignoreCaseSpecifies whether comparison is case-insensitive.
ciCulture to use for comparison.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ CompareOrdinal() [1/2]

static ASPOSECPP_SHARED_API int System::String::CompareOrdinal ( const String strA,
const String strB 
)
static

Less-equal-greater-compares two strings using ordinal mode.

Parameters
strAFirst string to compare.
strBSecond string to compare.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ CompareOrdinal() [2/2]

static ASPOSECPP_SHARED_API int System::String::CompareOrdinal ( const String strA,
int  indexA,
const String strB,
int  indexB,
int  length 
)
static

Less-equal-greater-compares two strings using ordinal mode.

Parameters
strAFirst string to compare.
indexABeginning of first string substring.
strBSecond string to compare.
indexBBeginning of the second string substring.
lengthNumber of characters to compare.
Returns
Negative value if first substring is less then second, zero if they match, positive value otherwise.

◆ CompareTo()

ASPOSECPP_SHARED_API int System::String::CompareTo ( const String str) const

Compares two strings in 'less-equals-more' style. Uses current culture.

Parameters
strString to compare this to.
Returns
Negative value if this is considered lower than str, zero if they match, positive value if this is greater than str.

◆ Concat() [1/4]

static ASPOSECPP_SHARED_API String System::String::Concat ( const ArrayPtr< String > &  parts)
static

Concatenates strings.

Parameters
partsStrings to concatenate.
Returns
String containing concatenated strings.

◆ Concat() [2/4]

static ASPOSECPP_SHARED_API String System::String::Concat ( const String str0,
const String str1 
)
static

Concatenates strings.

Parameters
str0First string to concatenate.
str1Second string to concatenate.
Returns
String containing concatenated strings.

◆ Concat() [3/4]

static ASPOSECPP_SHARED_API String System::String::Concat ( const String str0,
const String str1,
const String str2 
)
static

Concatenates strings.

Parameters
str0First string to concatenate.
str1Second string to concatenate.
str2Third string to concatenate.
Returns
String containing concatenated strings.

◆ Concat() [4/4]

static ASPOSECPP_SHARED_API String System::String::Concat ( const String str0,
const String str1,
const String str2,
const String str3 
)
static

Concatenates strings.

Parameters
str0First string to concatenate.
str1Second string to concatenate.
str2Third string to concatenate.
str3Fourth string to concatenate.
Returns
String containing concatenated strings.

◆ Contains()

ASPOSECPP_SHARED_API bool System::String::Contains ( const String str) const

Checks if str is a substring of current string.

Parameters
strLookup string.
Returns
true if substring is present, false otherwise.

◆ Copy()

static String System::String::Copy ( const String str)
inlinestatic

Creates string copy.

Parameters
strString to copy.
Returns
Copy of passed string.

◆ CopyTo()

ASPOSECPP_SHARED_API void System::String::CopyTo ( int  sourceIndex,
const ArrayPtr< char_t > &  destination,
int  destinationIndex,
int  count 
) const

Copies string characters into existing array elements. No resize is being done.

Parameters
sourceIndexIn-string index to start reading from.
destinationDestination array.
destinationIndexIn-array index to start writing from.
countNumber of characters to copy.

◆ end()

ASPOSECPP_SHARED_API const UChar* System::String::end ( ) const

Returns pointer to the end of actual string buffer. Never reallocates anything. Doesn't guarantee buffer to be null-terminated.

Returns
Pointer to the first element after actual string buffer, null-terminated or not.

◆ EndsWith() [1/3]

ASPOSECPP_SHARED_API bool System::String::EndsWith ( const String value) const

Checks if string ends with specified substring.

Parameters
valueLookup string.
Returns
true if string ends with specified substring, false otherwise.

◆ EndsWith() [2/3]

ASPOSECPP_SHARED_API bool System::String::EndsWith ( const String value,
System::StringComparison  comparisonType 
) const

Checks if string ends with specified substring.

Parameters
valueLookup string.
comparisonTypeComparison mode, see System::StringComparison for details.
Returns
true if string ends with specified substring, false otherwise.

◆ EndsWith() [3/3]

ASPOSECPP_SHARED_API bool System::String::EndsWith ( const String value,
bool  ignoreCase,
const SharedPtr< System::Globalization::CultureInfo > &  culture = nullptr 
) const

Checks if string ends with specified substring.

Parameters
valueLookup string.
ignoreCaseSpecifies whether comparison is case-insensitive.
cultureCulture to use while performing string comparison.
Returns
true if string ends with specified substring, false otherwise.

◆ Equals() [1/4]

ASPOSECPP_SHARED_API bool System::String::Equals ( const String str,
System::StringComparison  comparison_type 
) const

String equality comparison. Several modes provided by StringComparison enumeration are supported.

Parameters
strString to compare against the current one.
comparison_typeComparison mode (see System::StringComparison for details).
Returns
true if strings match using selected comparison type, false otherwise.

◆ Equals() [2/4]

ASPOSECPP_SHARED_API bool System::String::Equals ( const String str) const

String equality comparison. Uses System::StringComparison::Ordinal comparison mode.

Parameters
strString to compare against the current one.
Returns
true if strings match, false otherwise.

◆ Equals() [3/4]

static ASPOSECPP_SHARED_API bool System::String::Equals ( const String strA,
const String strB 
)
static

Equal-compares two strings using Ordial comparison mode.

Parameters
strAFirst string to compare.
strBSecond string to compare.
Returns
true if strings match, false otherwise.

◆ Equals() [4/4]

static ASPOSECPP_SHARED_API bool System::String::Equals ( const String strA,
const String strB,
System::StringComparison  comparison_type 
)
static

Equal-compares two strings.

Parameters
strAFirst string to compare.
strBSecond string to compare.
comparison_typeComparison mode.
Returns
true if strings match, false otherwise.

◆ FastToAscii()

int ASPOSECPP_SHARED_API System::String::FastToAscii ( char  buffer[],
int  buffer_size 
) const

Tries to convert a String to an ASCII string.

Parameters
bufferA buffer to store the resulting string.
buffer_sizeBuffer's size.
Returns
The resulting string length or -1 if a String is not an ASCII string.

◆ Format() [1/5]

template<class... Args>
String System::String::Format ( const SharedPtr< IFormatProvider > &  fp,
const String format,
const Args &...  args 
)
static

Formats string in C# style.

Template Parameters
ArgsArguments to format string.
Parameters
fpFormat provider to use to convert arguments to strings.
formatFormat string.
argsArguments to format string.

◆ Format() [2/5]

template<class... Args>
String System::String::Format ( std::nullptr_t  ,
const String format,
const Args &...  args 
)
static

Formats string in C# style.

Template Parameters
ArgsArguments to format string.
Parameters
formatFormat string.
argsArguments to format string.

◆ Format() [3/5]

template<std::size_t N, class... Args>
String System::String::Format ( std::nullptr_t  ,
const char16_t(&)  format[N],
const Args &...  args 
)
static

Formats string in C# style.

Template Parameters
ArgsArguments to format string.
Parameters
formatFormat string.
argsArguments to format string.

◆ Format() [4/5]

template<class... Args>
String System::String::Format ( const String format,
const Args &...  args 
)
static

Formats string in C# style.

Template Parameters
ArgsArguments to format string.
Parameters
formatFormat string.
argsArguments to format string.

◆ Format() [5/5]

template<class T>
String System::String::Format ( const String format,
const System::ArrayPtr< T > &  args 
)
static

Formats string in C# style.

Template Parameters
TArguments to format string.
Parameters
formatFormat string.
argsArguments to format string.

◆ FromAscii() [1/3]

static ASPOSECPP_SHARED_API String System::String::FromAscii ( const char *  asciiStr)
static

Creates String from ASCII string.

Parameters
asciiStrPointer to null-terminated string encoded using ASCII codepage.
Returns
String object representing passed string.

◆ FromAscii() [2/3]

static ASPOSECPP_SHARED_API String System::String::FromAscii ( const char *  asciiStr,
int  len 
)
static

Creates String from ASCII string.

Parameters
asciiStrPointer to string encoded using ASCII codepage.
lenNumber of characters to handle.
Returns
String object representing passed string.

◆ FromAscii() [3/3]

static ASPOSECPP_SHARED_API String System::String::FromAscii ( const std::string &  asciiStr)
static

Creates String from ASCII string.

Parameters
asciiStrASCII-encoded string.
Returns
String object representing passed string.

◆ FromUtf16()

static ASPOSECPP_SHARED_API String System::String::FromUtf16 ( const std::u16string &  u16str)
static

Creates String from utf16 string.

Parameters
u16strUtf16 string.
Returns
String object representing passed string.

◆ FromUtf32()

static ASPOSECPP_SHARED_API String System::String::FromUtf32 ( const uint32_t *  utf32,
int32_t  length 
)
static

Creates String from utf32 string.

Parameters
utf32Pointer to string encoded in utf32.
lengthNumber of characters to convert.
Returns
String object representing passed string.

◆ FromUtf8() [1/4]

static ASPOSECPP_SHARED_API String System::String::FromUtf8 ( const char *  utf8)
static

Creates String from utf8 string.

Parameters
utf8Pointer to null-terminated string encoded using utf8 codepage.
Returns
String object representing passed string.

◆ FromUtf8() [2/4]

static ASPOSECPP_SHARED_API String System::String::FromUtf8 ( const char *  utf8,
int  len 
)
static

Creates String from utf8 string.

Parameters
utf8Pointer to string encoded using utf8 codepage.
lenNumber of characters to handle.
Returns
String object representing passed string.

◆ FromUtf8() [3/4]

static ASPOSECPP_SHARED_API String System::String::FromUtf8 ( const uint8_t *  utf8)
static

Creates String from utf8 string.

Parameters
utf8Pointer to null-terminated string encoded using utf8 codepage.
Returns
String object representing passed string.

◆ FromUtf8() [4/4]

static ASPOSECPP_SHARED_API String System::String::FromUtf8 ( const std::string &  utf8)
static

Creates String from utf8 string.

Parameters
utf8Pointer to string encoded using utf8 codepage.
Returns
String object representing passed string.

◆ FromWCS()

static ASPOSECPP_SHARED_API String System::String::FromWCS ( const std::wstring &  wcs)
static

Creates String from widestring.

Parameters
wcsWidestring to convert into String.
Returns
String object representing passed string.

◆ get_Length()

ASPOSECPP_SHARED_API int System::String::get_Length ( ) const

Gets string length.

Returns
Length of contained string.

◆ GetHashCode()

ASPOSECPP_SHARED_API int System::String::GetHashCode ( ) const

Hashes contained string. Implemented in ICU, doesn't match hashes in C#.

Returns
Calculated hash code value.

◆ IndexOf() [1/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( const String str,
System::StringComparison  comparison_type 
) const

Substring forward lookup.

Parameters
strSubstring to look for.
comparison_typeComparison mode.
Returns
Index of first found substring or -1 if not found. For empty lookup string, always returns 0.

◆ IndexOf() [2/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( char_t  c,
int  startIndex = 0 
) const

Character forward lookup.

Parameters
cCharacter to look for.
startIndexIndex to start lookup at.
Returns
Index of first character position since startIndex or -1 if not found.

◆ IndexOf() [3/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( char_t  c,
int  startIndex,
int  count 
) const

Character forward lookup in substring.

Parameters
cCharacter to look for.
startIndexIndex to start lookup at.
countNumber of characters to look through.
Returns
Index of first character position since startIndex or -1 if not found.

◆ IndexOf() [4/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( const String str,
int  startIndex = 0 
) const

Substring forward lookup.

Parameters
strSubstring to look for.
startIndexPosition in source string to start lookup through.
Returns
Index of first found substring or -1 if not found. For empty lookup string, always returns startIndex.

◆ IndexOf() [5/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( const String str,
int  startIndex,
System::StringComparison  comparison_type 
) const

Substring forward lookup.

Parameters
strSubstring to look for.
startIndexPosition in source string to start lookup through.
comparison_typeComparison mode.
Returns
Index of first found substring or -1 if not found. For empty lookup string, always returns startIndex.

◆ IndexOf() [6/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( const String value,
int  startIndex,
int  count,
System::StringComparison  comparisonType 
) const

Substring forward lookup.

Parameters
valueSubstring to look for.
startIndexPosition in source string to start lookup through.
countnumber of characters to look through.
comparisonTypeComparison mode.
Returns
Index of first found substring or -1 if not found. For empty lookup string, always returns startIndex.

◆ IndexOf() [7/7]

ASPOSECPP_SHARED_API int System::String::IndexOf ( const String str,
int  startIndex,
int  count 
) const

Substring forward lookup.

Parameters
strSubstring to look for.
startIndexPosition in source string to start lookup through.
countnumber of characters to look through.
Returns
Index of first found substring or -1 if not found. For empty lookup string, always returns startIndex.

◆ IndexOfAny() [1/5]

ASPOSECPP_SHARED_API int System::String::IndexOfAny ( char_t  c,
int  startIndex = 0 
) const

Character forward lookup.

Parameters
cCharacter to look for.
startIndexIndex to start lookup at.
Returns
Index of first character position since startIndex or -1 if not found.

◆ IndexOfAny() [2/5]

ASPOSECPP_SHARED_API int System::String::IndexOfAny ( const String str,
int  startIndex = 0 
) const

Consequently looks for all characters of str in this. If first character is found, its position is returned, otherwise looks for the second one and so on.

Parameters
strString of characters to look for. Order of characters matters.
startIndexPosition to start lookup from.
Returns
Index of first found character or -1 if none is found.

◆ IndexOfAny() [3/5]

ASPOSECPP_SHARED_API int System::String::IndexOfAny ( const ArrayPtr< char_t > &  anyOf) const

Looks for any of passed characters through the whole string. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
Returns
Index of the first matching character or -1 if not found.

◆ IndexOfAny() [4/5]

ASPOSECPP_SHARED_API int System::String::IndexOfAny ( const ArrayPtr< char_t > &  anyOf,
int32_t  startindex 
) const

Looks for any of passed characters through substring. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
startindexIndex to start lookup from.
Returns
Index of the first matching character or -1 if not found.

◆ IndexOfAny() [5/5]

ASPOSECPP_SHARED_API int System::String::IndexOfAny ( const ArrayPtr< char_t > &  anyOf,
int32_t  startindex,
int32_t  count 
) const

Looks for any of passed characters through substring. Compares first string character to all characters in anyOf, then compares second one and so on. Returns index of the first one matching any of the target characters.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
startindexIndex to start lookup from.
countNumber of characters to look through.
Returns
Index of the first matching character or -1 if not found.

◆ Insert()

ASPOSECPP_SHARED_API String System::String::Insert ( int  startIndex,
const String value 
) const

Inserts substring at specified position.

Parameters
startIndexIndex in this string to start inserting from.
valueInsertion string.
Returns
String with insertion done.

◆ Is()

bool System::String::Is ( const System::TypeInfo target) const
inline

Checks if string object is of type specified by TypeInfo passed.

Parameters
targetTypeInfo to check against.
Returns
true if target is TypeInfo of String class, false otherwise.

◆ IsAsciiString()

bool ASPOSECPP_SHARED_API System::String::IsAsciiString ( ) const

Indicates if a String contains ASCII symbols only.

Returns
True if a string is an ASCII string.

◆ IsEmpty()

ASPOSECPP_SHARED_API bool System::String::IsEmpty ( ) const

Checks if string is both non-null and empty.

Returns
true if string is empty and not null, false otherwise.

◆ IsNormalized()

ASPOSECPP_SHARED_API bool System::String::IsNormalized ( System::Text::NormalizationForm  form) const

Checks if unicode string is normalized using normalization form specified.

Parameters
formNormalization form, see System::Text::NormalizationForm for details.
Returns
true if string is already normalized, false otherwise.

◆ IsNull()

bool System::String::IsNull ( ) const
inline

Checks if string is considered null. String is null and only if it is constructed via String() constructor, moved, copied or assigned from null string or reset() method was called.

Returns
true if string is considered null, false otherwise.

◆ IsNullOrEmpty() [1/2]

ASPOSECPP_SHARED_API bool System::String::IsNullOrEmpty ( ) const

Checks if string is empty or is considered null.

Returns
true if string is empty or null, false otherwise.

◆ IsNullOrEmpty() [2/2]

static ASPOSECPP_SHARED_API bool System::String::IsNullOrEmpty ( const String str)
static

Checks if passed string is null or empty.

Parameters
strString to check.
Returns
true if string is null or empty, false otherwise.

◆ IsNullOrWhiteSpace()

static ASPOSECPP_SHARED_API bool System::String::IsNullOrWhiteSpace ( const String str)
static

Indicates whether a specified string is null, empty, or consists only of white-space characters.

Parameters
strString to check.
Returns
true if string is null or empty or consists exclusively of white-space characters, false otherwise.

◆ Join() [1/4]

static ASPOSECPP_SHARED_API String System::String::Join ( const String separator,
const ArrayPtr< String > &  parts,
int  startIndex = 0,
int  count = -1 
)
static

Joins array using string as separator.

Parameters
separatorString to put between array elements when joining them.
partsArray of parts to join.
startIndexFirst index in array to start joining from.
countNumber of array elements to join. -1 means 'until array ends'.
Returns
String representing joint array elements.

◆ Join() [2/4]

static ASPOSECPP_SHARED_API String System::String::Join ( const String separator,
const System::Details::ArrayView< String > &  parts,
int  startIndex = 0,
int  count = -1 
)
static

Joins array using string as separator.

Parameters
separatorString to put between array elements when joining them.
partsArrayView of parts to join.
startIndexFirst index in array to start joining from.
countNumber of array elements to join. -1 means 'until array ends'.
Returns
String representing joint array elements.

◆ Join() [3/4]

static ASPOSECPP_SHARED_API String System::String::Join ( const String separator,
const SharedPtr< System::Collections::Generic::IEnumerable< String > > &  parts 
)
static

Joins array using string as separator.

Parameters
separatorString to put between array elements when joining them.
parts- parts enumerable object
Returns
String representing joint elements.

◆ Join() [4/4]

static ASPOSECPP_SHARED_API String System::String::Join ( const String separator,
const ArrayPtr< SharedPtr< Object >> &  parts 
)
static

Joins array using string as separator.

Parameters
separatorString to put between array elements when joining them.
partsArray of parts to join.
Returns
String representing joint elements.

◆ LastIndexOf() [1/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( const String str,
int  startIndex = INT32_MAX 
) const

Substring backward lookup.

Parameters
strSubstring to look for.
startIndexPosition in source string to start lookup through.
Returns
Index of last found substring or -1 if not found. For empty lookup string, always returns string length.

◆ LastIndexOf() [2/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( const String str,
System::StringComparison  comparison_type 
) const

Substring backward lookup.

Parameters
strSubstring to look for.
comparison_typeComparison mode.
Returns
Index of last found substring or -1 if not found. For empty lookup string, always returns string length.

◆ LastIndexOf() [3/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( const String str,
int  startIndex,
System::StringComparison  comparison_type 
) const

Substring backward lookup.

Parameters
strSubstring to look for.
startIndexPosition in source string to start lookup through.
comparison_typeComparison mode.
Returns
Index of last found substring or -1 if not found. For empty lookup string, always returns string length.

◆ LastIndexOf() [4/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( const String value,
int  startIndex,
int  count,
StringComparison  comparisonType 
) const

Substring backward lookup.

Parameters
valueSubstring to look for.
startIndexPosition in source string to start lookup through.
countNumber of characters to look through.
comparisonTypeComparison mode.
Returns
Index of last found substring or -1 if not found. For empty lookup string, always returns startIndex+count.

◆ LastIndexOf() [5/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( char_t  value) const

Character backward lookup.

Parameters
valueCharacter to look for.
Returns
Index of last character position or -1 if not found.

◆ LastIndexOf() [6/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( char_t  value,
int32_t  startIndex 
) const

Character backward lookup.

Parameters
valueCharacter to look for.
startIndexIndex to start lookup at.
Returns
Index of last character position since startIndex or -1 if not found.

◆ LastIndexOf() [7/7]

ASPOSECPP_SHARED_API int System::String::LastIndexOf ( char_t  value,
int32_t  startIndex,
int32_t  count 
) const

Character backward lookup.

Parameters
valueCharacter to look for.
startIndexIndex to start lookup at.
countNumber of characters to look through
Returns
Index of last character position since startIndex or -1 if not found.

◆ LastIndexOfAny() [1/3]

ASPOSECPP_SHARED_API int System::String::LastIndexOfAny ( const ArrayPtr< char_t > &  anyOf) const

Looks for any of passed characters through whole string backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
Returns
Index of the last matching character or -1 if not found.

◆ LastIndexOfAny() [2/3]

ASPOSECPP_SHARED_API int System::String::LastIndexOfAny ( const ArrayPtr< char_t > &  anyOf,
int32_t  startindex 
) const

Looks for any of passed characters through substring backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
startindexIndex to start lookup from.
Returns
Index of the last matching character or -1 if not found.

◆ LastIndexOfAny() [3/3]

ASPOSECPP_SHARED_API int System::String::LastIndexOfAny ( const ArrayPtr< char_t > &  anyOf,
int32_t  startindex,
int32_t  count 
) const

Looks for any of passed characters through substring backwardly. Compares last string character to all characters in anyOf, then compares previous one and so on. Returns index of the first match found.

Parameters
anyOfArray of characters to look for. Order doesn't matter.
startindexIndex to start lookup from.
countNumber of characters to look through.
Returns
Index of the last matching character or -1 if not found.

◆ Normalize()

ASPOSECPP_SHARED_API String System::String::Normalize ( System::Text::NormalizationForm  form) const

Normalizes unicode string using normalization form specified.

Parameters
formNormalization form, see System::Text::NormalizationForm for details.
Returns
Normalized string.

◆ operator!=() [1/2]

ASPOSECPP_SHARED_API bool System::String::operator!= ( const String str) const

Non-equality comparison operator.

Parameters
strString to compare current one to.
Returns
false if both strings are null or both are not null and match, true otherwise.

◆ operator!=() [2/2]

ASPOSECPP_SHARED_API bool System::String::operator!= ( std::nullptr_t  ) const

Checks if string is not null. Applies same logic as IsNull() call.

Returns
false if string is null, true otherwise.

◆ operator+() [1/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( const String str) const

String concatenation operator.

Parameters
strString to add to the end of current one.
Returns
Concatenated string.

◆ operator+() [2/10]

template<typename T , std::enable_if_t< IsStringLiteral< T, char_t >::value > * = nullptr>
String System::String::operator+ ( const T &  arg) const
inline

String concatenation with string literal or character string pointer.

Template Parameters
TOne of string literal or character string pointer forms.
Parameters
argEntity to concatenate with current string.
Returns
Concatenated string.

◆ operator+() [3/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( char_t  x) const

Adds character to the end of the string.

Parameters
xCharacter to add.
Returns
String concatenation result.

◆ operator+() [4/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( int  i) const

Adds integer value string representation to the end of the string.

Parameters
iInteger value to convert to string and to add.
Returns
String concatenation result.

◆ operator+() [5/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( uint32_t  i) const

Adds unsigned integer value string representation to the end of the string.

Parameters
iValue to convert to string and to add.
Returns
String concatenation result.

◆ operator+() [6/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( double  d) const

Adds floating point value string representation to the end of the string.

Parameters
dValue to convert to string and to add.
Returns
String concatenation result.

◆ operator+() [7/10]

ASPOSECPP_SHARED_API String System::String::operator+ ( int64_t  v) const

Adds integer value string representation to the end of the string.

Parameters
vValue to convert to string and to add to add.
Returns
String concatenation result.

◆ operator+() [8/10]

template<typename T , std::enable_if_t< IsSmartPtr< T >::value > * = nullptr>
String System::String::operator+ ( const T &  value) const
inline

Adds reference type object string representation to the end of the string.

Template Parameters
Tpointer type.
Parameters
valueObject to convert to string using ToString() call and to add to current string.
Returns
String concatenation result.

◆ operator+() [9/10]

template<typename T , std::enable_if_t<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!std::is_array< T >::value > * = nullptr>
String System::String::operator+ ( const T &  value) const
inline

Adds value type object string representation to the end of the string.

Template Parameters
TValue type to call ToString() upon.
Parameters
valueObject to convert to string using ToString() call and to add to current string.
Returns
String concatenation result.

◆ operator+() [10/10]

template<typename T , std::enable_if_t< std::is_same< T, bool >::value > * = nullptr>
String System::String::operator+ ( arg) const
inline

Adds boolean value string representation to the end of the string.

Template Parameters
TValue type to concatenate with string. Must be bool
Parameters
argBoolean value to convert to string and to add.
Returns
String concatenation result.

◆ operator+=() [1/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( char_t  c)

Concatenation assignment operator.

Parameters
cCharacter to add to the end of current string.
Returns
self reference.

◆ operator+=() [2/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( const String str)

Concatenation assignment operator.

Parameters
strString to add to the end of current string.
Returns
self reference.

◆ operator+=() [3/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( double  value)

Concatenation assignment operator.

Parameters
valueDouble to add to the end of current string.
Returns
self reference.

◆ operator+=() [4/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( uint8_t  value)

Concatenation assignment operator.

Parameters
valueByte to add to the end of current string.
Returns
self reference.

◆ operator+=() [5/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( int16_t  value)

Concatenation assignment operator.

Parameters
valueShort to add to the end of current string.
Returns
self reference.

◆ operator+=() [6/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( uint16_t  value)

Concatenation assignment operator.

Parameters
valueUnsigned short to add to the end of current string.
Returns
self reference.

◆ operator+=() [7/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( int32_t  value)

Concatenation assignment operator.

Parameters
valueInt to add to the end of current string.
Returns
self reference.

◆ operator+=() [8/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( uint32_t  value)

Concatenation assignment operator.

Parameters
valueUnsigned int to add to the end of current string.
Returns
self reference.

◆ operator+=() [9/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( int64_t  value)

Concatenation assignment operator.

Parameters
valueLong to add to the end of current string.
Returns
self reference.

◆ operator+=() [10/11]

ASPOSECPP_SHARED_API String& System::String::operator+= ( uint64_t  value)

Concatenation assignment operator.

Parameters
valueUnsigned long to add to the end of current string.
Returns
self reference.

◆ operator+=() [11/11]

template<typename T , std::enable_if_t< std::is_same< T, bool >::value > * = nullptr>
String& System::String::operator+= ( value)
inline

Concatenation assignment operator.

Template Parameters
TValue type to concatenate with string. Must be bool
Parameters
valueBoolean to add to the end of current string.
Returns
self reference.

◆ operator<()

ASPOSECPP_SHARED_API bool System::String::operator< ( const String str) const

Order-compares strings.

Parameters
strString to compare current one to.
Returns
true if this is considering less than str, false otherwise.

◆ operator=() [1/2]

ASPOSECPP_SHARED_API String& System::String::operator= ( const String str)

Assignment operator.

Parameters
strString to copy.
Returns
Self reference.

◆ operator=() [2/2]

ASPOSECPP_SHARED_API String& System::String::operator= ( String &&  str)
noexcept

Move assignment operator.

Parameters
strString to move data from.
Returns
Self reference.

◆ operator==() [1/2]

ASPOSECPP_SHARED_API bool System::String::operator== ( const String str) const

Equality comparison operator.

Parameters
strString to compare current one to.
Returns
true if both strings are null or both are not null and match, false otherwise.

◆ operator==() [2/2]

ASPOSECPP_SHARED_API bool System::String::operator== ( std::nullptr_t  ) const

Checks if string is null. Applies same logic as IsNull() call.

Returns
true if string is null, false otherwise.

◆ operator[]()

ASPOSECPP_SHARED_API char_t System::String::operator[] ( int  index) const

Gets character at specified position.

Parameters
indexIndex to get character from.
Returns
Character at specified position or 0xffff if out of bounds.

◆ PadLeft()

ASPOSECPP_SHARED_API String System::String::PadLeft ( int  totalWidth,
char_t  c = u' ' 
) const

Adds padding on the left of original string.

Parameters
totalWidthNumber of padding characters to insert.
cPadding character.
Returns
String with padding inserted.

◆ PadRight()

ASPOSECPP_SHARED_API String System::String::PadRight ( int  totalWidth,
char_t  c = u' ' 
) const

Adds padding on the right of original string.

Parameters
totalWidthNumber of padding characters to insert.
cPadding character.
Returns
String with padding inserted.

◆ rbegin()

ASPOSECPP_SHARED_API reverse_iterator System::String::rbegin ( ) const

Returns reverse iterator to the last character (if any) of actual string buffer.

Returns
Reverse iterator to the last character of actual string buffer (if any) or same as rend().

◆ Remove()

ASPOSECPP_SHARED_API String System::String::Remove ( int32_t  startIndex,
int32_t  count = INT32_MAX 
) const

Extracts everything but substring from current string.

Parameters
startIndexIndex of first character to not extract.
countNumber of characters to not extract.
Returns
String around specified substring.

◆ rend()

ASPOSECPP_SHARED_API reverse_iterator System::String::rend ( ) const

Returns reverse iterator to the before first character (if any) of actual string buffer.

Returns
Reverse iterator to the element preceding first character of actual string buffer (if any) or to element just before allocated buffer.

◆ Replace() [1/2]

ASPOSECPP_SHARED_API String System::String::Replace ( char_t  oldValue,
char_t  newValue 
) const

Replaces all occurrences of character in the string.

Parameters
oldValueCharacter to replace.
newValuereplacement value.
Returns
String with replacement done.

◆ Replace() [2/2]

ASPOSECPP_SHARED_API String System::String::Replace ( const String oldValue,
const String newValue 
) const

Replaces all occurrences of lookup in this string.

Parameters
oldValueString to replace.
newValuereplacement string.
Returns
String with replacement done.

◆ reset()

ASPOSECPP_SHARED_API String& System::String::reset ( )

Sets string to null. Is analogous to 'string_variable_name = null' in C#.

Returns
Self reference.

◆ SetCharAt()

ASPOSECPP_SHARED_API String& System::String::SetCharAt ( int  index,
char_t  ch 
)

Sets character at specified position.

Parameters
indexIndex to set character at.
chCharacter to put at specified position.
Returns
Self reference.

◆ Split() [1/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( char_t  separator = u' ',
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by character.

Parameters
separatorCharacter to split string by.
optSplitting options.
Returns
Array of substrings.

◆ Split() [2/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( char_t  separator,
int32_t  count,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by character.

Parameters
separatorCharacter to split string by.
countThe maximum number of substrings to return.
optSplitting options.
Returns
Array of substrings.

◆ Split() [3/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( char_t  separatorA,
char_t  separatorB,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by one of two characters.

Parameters
separatorAFirst character to split string by.
separatorBSecond character to split string by.
optSplitting options.
Returns
Array of substrings.

◆ Split() [4/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const ArrayPtr< char_t > &  separators,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by one of characters specified.

Parameters
separatorsArray of separator characters. If empty, any whitespace character is considered a separator.
optSplitting options.
Returns
Array of substrings.

◆ Split() [5/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const ArrayPtr< char_t > &  separators,
int32_t  count,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by one of characters specified.

Parameters
separatorsArray of separator characters. If empty, any whitespace character is considered a separator.
countThe maximum number of substrings to return.
optSplitting options.
Returns
Array of substrings.

◆ Split() [6/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const String separator,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by substring.

Parameters
separatorSubstring acting as separator. If empty, whitespace character acts as separator.
optSplitting options.
Returns
Array of substrings.

◆ Split() [7/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const String separator,
int  count,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by substring.

Parameters
separatorSubstring acting as separator. If empty, whitespace character acts as separator.
countMax number of elements in splits array.
optSplitting options.
Returns
Array of substrings.

◆ Split() [8/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const ArrayPtr< String > &  separators,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by substring.

Parameters
separatorsArray of separator strings. If empty, no splitting is done.
optSplitting options.
Returns
Array of substrings.

◆ Split() [9/9]

ASPOSECPP_SHARED_API ArrayPtr<String> System::String::Split ( const ArrayPtr< String > &  separators,
int  count,
StringSplitOptions  opt = StringSplitOptions::None 
) const

Splits string by substring. Currently, only supports separators array of zero or one elements.

Parameters
separatorsArray of separator strings. If empty, no splitting is done.
countMax number of elements in splits array.
optSplitting options.
Returns
Array of substrings.

◆ StartsWith() [1/3]

ASPOSECPP_SHARED_API bool System::String::StartsWith ( const String value) const

Checks if string begins with specified substring.

Parameters
valueLookup string.
Returns
true if string starts with specified substring, false otherwise.

◆ StartsWith() [2/3]

ASPOSECPP_SHARED_API bool System::String::StartsWith ( const String value,
System::StringComparison  comparisonType 
) const

Checks if string begins with specified substring.

Parameters
valueLookup string.
comparisonTypeComparison mode, see System::StringComparison for details.
Returns
true if string starts with specified substring, false otherwise.

◆ StartsWith() [3/3]

ASPOSECPP_SHARED_API bool System::String::StartsWith ( const String value,
bool  ignoreCase,
const SharedPtr< System::Globalization::CultureInfo > &  culture = nullptr 
) const

Checks if string begins with specified substring.

Parameters
valueLookup string.
ignoreCaseSpecifies whether comparison is case-insensitive.
cultureCulture to use while performing string comparison.
Returns
true if string starts with specified substring, false otherwise.

◆ Substring() [1/2]

ASPOSECPP_SHARED_API String System::String::Substring ( int32_t  startIndex) const

Extracts substring.

Parameters
startIndexSubstring start index.
Returns
Extracted substring.

◆ Substring() [2/2]

ASPOSECPP_SHARED_API String System::String::Substring ( int32_t  startIndex,
int32_t  length 
) const

Extracts substring.

Parameters
startIndexSubstring start index.
lengthSubstring length.
Returns
Extracted substring.

◆ ToAsciiString()

ASPOSECPP_SHARED_API std::string System::String::ToAsciiString ( ) const

Converts string to std::string. Uses ASCII encoding.

Returns
String representation in Ascii.
Exceptions
FormatExceptionif a string contains non-ASCII characters.

◆ ToByteArray()

ASPOSECPP_SHARED_API ArrayPtr<uint8_t> System::String::ToByteArray ( int32_t  startIndex = 0,
int32_t  length = INT32_MAX,
bool  LE = true 
) const

Converts string or substring to array of bytes.

Parameters
startIndexSubstring start index.
lengthSubstring length.
LEIf true, encode characters using little endianness; otherwise, use big endianness.
Returns
Array containing bytes representing characters of the string.

◆ ToCharArray()

ASPOSECPP_SHARED_API ArrayPtr<char_t> System::String::ToCharArray ( int32_t  startIndex = 0,
int32_t  length = INT32_MAX 
) const

Converts string or substring to array of characters.

Parameters
startIndexSubstring start index.
lengthSubstring length.
Returns
Array containing characters of the string.

◆ ToLower() [1/2]

ASPOSECPP_SHARED_API String System::String::ToLower ( ) const

Converts all string's characters to lower case.

Returns
Converted string.

◆ ToLower() [2/2]

ASPOSECPP_SHARED_API String System::String::ToLower ( const SharedPtr< System::Globalization::CultureInfo > &  cultureInfo) const

Converts all string's characters to lower case using specific culture.

Parameters
cultureInfoCulture to use.
Returns
Converted string.

◆ ToLowerInvariant()

ASPOSECPP_SHARED_API String System::String::ToLowerInvariant ( ) const

Converts all string's characters to lower case using invariant culture.

Returns
Converted string.

◆ ToString() [1/2]

String System::String::ToString ( ) const
inline

Wrapper for handling String class in contexts where ToString() is being called on value type objects.

Returns
Copy of current string. It is considered a null string if current string is a null string.

◆ ToString() [2/2]

String System::String::ToString ( const SharedPtr< IFormatProvider > &  ) const
inline

Wrapper for handling String class in contexts where ToString() is being called on value type objects.

Returns
Copy of current string. It is considered a null string if current string is a null string.

◆ ToU16Str()

ASPOSECPP_SHARED_API std::u16string System::String::ToU16Str ( ) const

Converts string to std::u16string.

Returns
Original string converted to u16string.

◆ ToU32Str()

ASPOSECPP_SHARED_API std::u32string System::String::ToU32Str ( ) const

Converts string to std::u32string.

Returns
Original string converted to u32string.

◆ ToUpper() [1/2]

ASPOSECPP_SHARED_API String System::String::ToUpper ( ) const

Converts all string's characters to upper case.

Returns
Converted string.

◆ ToUpper() [2/2]

ASPOSECPP_SHARED_API String System::String::ToUpper ( const SharedPtr< System::Globalization::CultureInfo > &  cultureInfo) const

Converts all string's characters to upper case using specific culture.

Parameters
cultureInfoCulture to use.
Returns
Converted string.

◆ ToUpperInvariant()

ASPOSECPP_SHARED_API String System::String::ToUpperInvariant ( ) const

Converts all string's characters to upper case using invariant culture.

Returns
Converted string.

◆ ToUtf8String()

ASPOSECPP_SHARED_API std::string System::String::ToUtf8String ( ) const

Converts string to std::string. Uses UTF-8 encoding.

Returns
String representation in utf-8.

◆ ToWCS()

ASPOSECPP_SHARED_API std::wstring System::String::ToWCS ( ) const

Converts string to std::wstring.

Returns
Original string converted to wstring.

◆ Trim() [1/4]

ASPOSECPP_SHARED_API String System::String::Trim ( ) const

Removes all whitespace characters from both beginning and end of the string.

Returns
String with no whitespaces at beginning or end.

◆ Trim() [2/4]

ASPOSECPP_SHARED_API String System::String::Trim ( char_t  ch) const

Removes all occurrences of passed character from both beginning and end of the string.

Parameters
chSymbol to remove.
Returns
Removal result.

◆ Trim() [3/4]

ASPOSECPP_SHARED_API String System::String::Trim ( const String anyOf) const

Removes all occurrences of passed characters from both beginning and end of the string.

Parameters
anyOfString of characters to remove.
Returns
String without removed characters.

◆ Trim() [4/4]

ASPOSECPP_SHARED_API String System::String::Trim ( const ArrayPtr< char_t > &  anyOf) const

Removes all occurrences of passed characters from both beginning and end of the string.

Parameters
anyOfArray of characters to remove.
Returns
String without removed characters.

◆ TrimEnd() [1/4]

ASPOSECPP_SHARED_API String System::String::TrimEnd ( ) const

Removes all whitespace characters from end of the string.

Returns
String with no whitespaces at beginning.

◆ TrimEnd() [2/4]

ASPOSECPP_SHARED_API String System::String::TrimEnd ( char_t  ch) const

Removes all occurrences of passed character from end of the string.

Parameters
chSymbol to remove.
Returns
Removal result.

◆ TrimEnd() [3/4]

ASPOSECPP_SHARED_API String System::String::TrimEnd ( const String anyOf) const

Removes all occurrences of passed characters from end of the string.

Parameters
anyOfString of characters to remove.
Returns
String without removed characters.

◆ TrimEnd() [4/4]

ASPOSECPP_SHARED_API String System::String::TrimEnd ( const ArrayPtr< char_t > &  anyOf) const

Removes all occurrences of passed characters from end of the string.

Parameters
anyOfArray of characters to remove.
Returns
String without removed characters.

◆ TrimStart() [1/4]

ASPOSECPP_SHARED_API String System::String::TrimStart ( ) const

Removes all whitespace characters from beginning of the string.

Returns
String with no whitespaces at beginning.

◆ TrimStart() [2/4]

ASPOSECPP_SHARED_API String System::String::TrimStart ( char_t  ch) const

Removes all occurrences of passed character from beginning of the string.

Parameters
chSymbol to remove.
Returns
Removal result.

◆ TrimStart() [3/4]

ASPOSECPP_SHARED_API String System::String::TrimStart ( const String anyOf) const

Removes all occurrences of passed characters from beginning of the string.

Parameters
anyOfString of characters to remove.
Returns
String without removed characters.

◆ TrimStart() [4/4]

ASPOSECPP_SHARED_API String System::String::TrimStart ( const ArrayPtr< char_t > &  anyOf) const

Removes all occurrences of passed characters from beginning of the string.

Parameters
anyOfArray of characters to remove.
Returns
String without removed characters.

◆ u_str()

ASPOSECPP_SHARED_API const UChar* System::String::u_str ( ) const

Returns ICU-styled null-terminated buffer. May reallocate the string.

Returns
Pointer to null-terminated string buffer.

Member Data Documentation

◆ Empty

const ASPOSECPP_SHARED_API String System::String::Empty
static

Empty string.

◆ m_state

uintptr_t System::String::m_state
protected

String state. Contains value 0 if string is null, 1 if string is constructed from string literal.

◆ m_str

Detail::UnicodeStringHolder System::String::m_str
mutableprotected

Actual string value.

◆ Null

const ASPOSECPP_SHARED_API String System::String::Null
static

Null string.