C++ API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Public Static Functions | Friends | List of all members
String Class Reference

The String class is used to work with Unicode strings encoded in UTF16.

In UTF16, 21-bit Unicode values (code points) are encoded with either a single 16-bit value (code unit) if the code point is in [0..65535], or a pair of 16-bit code units (surrogate pair) if the code point is greater then 65535.

Except where noted, all indexes, offsets, and counts into the String class are in terms of code units.

Instances of the String class are immutable and cannot be changed. Concatenation and replacement operations result in the return of new String instances. This design decision allows internal string data to be reference counted and shared across threads without any synchronization by consumers of the class.

It is therefore much more efficient to use the StringBuilder class to build a string programmatically than it is to use the String concatenation operations.

Public Functions

template<typename T >
As () const
 
Char16 CharAt (SizeType offset) const
 
Char32 CodePointAt (SizeType offset) const
 
SizeType CodePointIndex (SizeType offset) const
 
SizeType CodePointIndexNext (SizeType offset) const
 
SizeType CodePointIndexPrev (SizeType offset) const
 
SizeType CodePointLength (SizeType offset=0, SizeType count=Everything) const
 
int Compare (String const &other, SizeType offset=0, SizeType count=Everything) const
 
int CompareNoCase (String const &other, SizeType offset=0, SizeType count=Everything) const
 
String Concatenate (char const *other, SizeType count=Everything) const
 
String Concatenate (String const &other) const
 
String Concatenate (Char16 other) const
 
String Concatenate (AsciiArray const &other) const
 
String Concatenate (Utf16Array const &other) const
 
String Concatenate (Utf32Array const &other) const
 
bool Contains (String const &value, SizeType offset=0, SizeType count=Everything) const
 
bool Contains (Char16 value, SizeType offset=0, SizeType count=Everything) const
 
virtual void Deserialize (SerializationInfo const &info)
 
ByteArray Encode (String const &encodingName) const
 
ByteArray Encode (Text::Encoding &encoding) const
 
AsciiArray EncodeSystem () const
 
bool EndsWith (String const &value) const
 
bool EndsWith (Char16 value) const
 
String Escape () const
 
String FoldCase () const
 
Collections::EnumeratorT< Char32 > GetCodePointEnumerator () const
 
Collections::EnumeratorT< StringGetGraphemeEnumerator () const
 
HashCode GetHashCode () const
 
Collections::EnumeratorT< Char32 > GetReverseCodePointEnumerator () const
 
SizeType IndexOf (Char16 value, SizeType offset=0, SizeType count=Everything) const
 
SizeType IndexOf (String const &value, SizeType offset=0, SizeType count=Everything) const
 
SizeType IndexOf (Utf16Array const &seq, SizeType offset=0, SizeType count=Everything) const
 
SizeType IndexOfAny (String const &chars, SizeType offset=0, SizeType count=Everything) const
 
SizeType IndexOfAny (Char16Array const &chars, SizeType offset=0, SizeType count=Everything) const
 
bool IsEmpty () const
 
bool IsNormalized (UnicodeNormalizationForm::Enum normalizationForm=UnicodeNormalizationForm::Compose) const
 
String Join (Collections::IList< String > const &values) const
 
SizeType LastIndexOf (Char16 value, SizeType offset=0, SizeType count=Everything) const
 
SizeType LastIndexOf (String const &value, SizeType offset=0, SizeType count=Everything) const
 
SizeType LastIndexOf (Utf16Array const &seq, SizeType offset=0, SizeType count=Everything) const
 
SizeType LastIndexOfAny (String const &value, SizeType offset=0, SizeType count=Everything) const
 
SizeType LastIndexOfAny (Char16Array const &value, SizeType offset=0, SizeType count=Everything) const
 
SizeType Length () const
 
String Normalize (UnicodeNormalizationForm::Enum normalizationForm=UnicodeNormalizationForm::Compose) const
 
bool operator!= (String const &other) const
 
String operator+ (char const *other) const
 
String operator+ (String const &other) const
 
String operator+ (Char16 other) const
 
String operator+ (AsciiArray const &other) const
 
String operator+ (Utf16Array const &other) const
 
String operator+ (Utf32Array const &other) const
 
Stringoperator+= (char const *other)
 
Stringoperator+= (String const &other)
 
Stringoperator+= (Char16 other)
 
Stringoperator+= (AsciiArray const &other)
 
Stringoperator+= (Utf16Array const &other)
 
Stringoperator+= (Utf32Array const &other)
 
bool operator< (String const &other) const
 
bool operator<= (String const &other) const
 
Stringoperator= (char value)
 
Stringoperator= (Char16 value)
 
Stringoperator= (Char32 value)
 
Stringoperator= (char const *pszValue)
 
Stringoperator= (const std::string &value)
 
Stringoperator= (Utf8Array const &value)
 
Stringoperator= (AsciiArray const &value)
 
Stringoperator= (Utf16Array const &value)
 
Stringoperator= (Utf32Array const &value)
 
Stringoperator= (StringBuffer const &value)
 
bool operator== (String const &other) const
 
bool operator> (String const &other) const
 
bool operator>= (String const &other) const
 
Char16 operator[] (SizeType offset) const
 
bool ReferenceEquals (String const &other) const
 
String Replace (Char16 value, Char16 replacement) const
 
String Replace (Char16 value, String const &replacement) const
 
String Replace (String const &value, String const &replacement) const
 
String Replace (String const &value, Char16 replacement) const
 
String ReplaceRange (SizeType offset, SizeType count, String const &replacement) const
 
String Reverse (SizeType start=0, SizeType count=Everything) const
 
virtual void Serialize (SerializationInfo &info) const
 
Collections::List< StringSplit (Char16 delimiter, bool removeEmpty=true, SizeType offset=0, SizeType maxValues=Everything) const
 
Collections::List< StringSplit (String const &delimiter, bool removeEmpty=true, SizeType offset=0, SizeType maxValues=Everything) const
 
Collections::List< StringSplit (Char16Array const &delimiters, bool removeEmpty=true, SizeType offset=0, SizeType maxValues=Everything) const
 
bool StartsWith (String const &value) const
 
bool StartsWith (Char16 value) const
 
String Substring (SizeType start=0, SizeType count=Everything) const
 
AsciiArray ToAscii (char substitution= '_') const
 
ByteArray ToLatin1 () const
 
String ToLower (Locale const &locale) const
 
std::string ToStdUtf8 ()
 
String ToTitle (Locale const &locale) const
 
String ToUpper (Locale const &locale) const
 
Utf16Array ToUtf16 () const
 
const Utf16Array ToUtf16NoCopy () const
 
Utf32Array ToUtf32 (Char32 substitution=Char32(0xFFFD)) const
 
Utf8Array ToUtf8 (Char32 substitution=Char32(0xFFFD)) const
 
String Trim (String const &chars=String::Empty()) const
 
String TrimEnd (String const &chars=String::Empty()) const
 
String TrimStart (String const &chars=String::Empty()) const
 
template<typename T >
bool TryConvert (T &result) const
 
String Unescape () const
 
Constructors and Destructors
 String ()
 
 String (char value)
 
 String (Char16 value)
 
 String (Char32 value)
 
 String (char const *pszValue, SizeType count=Everything)
 
 String (const std::string &value)
 
 String (String const &value, SizeType offset, SizeType count=Everything)
 
 String (Utf8Array const &value, SizeType offset=0, SizeType count=Everything)
 
 String (AsciiArray const &value, SizeType offset=0, SizeType count=Everything)
 
 String (Utf16Array const &value, SizeType offset=0, SizeType count=Everything)
 
 String (Utf32Array const &value, SizeType offset=0, SizeType count=Everything)
 
template<unsigned N>
 String (Char16 const (&elements)[N])
 
 String (Char16 const *pValue, SizeType count)
 
template<unsigned N>
 String (Char32 const (&elements)[N])
 
 String (Char32 const *pValue, SizeType count)
 
 String (StringBuffer const &value)
 
 ~String ()
 

Public Static Functions

static String const & Empty ()
 
template<typename T >
static Nullable< StringFrom (T const &value)
 
static String FromAscii (char const *pSrc, SizeType count=Everything)
 
static String FromAsciiFoldCase (char const *pSrc, SizeType count=Everything)
 
static String FromEncoding (String const &encodingName, ByteArray const &bytes, SizeType offset=0, SizeType count=Everything)
 
static String FromEncoding (Text::Encoding &encoding, ByteArray const &bytes, SizeType offset=0, SizeType count=Everything)
 
static String FromEscapedAscii (char const *pSrc, SizeType count=Everything)
 
static String FromLatin1 (ByteArray const &latin1, SizeType offset=0, SizeType count=Everything)
 
static String FromUtf16 (Utf16Array const &utf16, SizeType offset=0, SizeType count=Everything)
 
static String FromUtf32 (Utf32Array const &utf32, SizeType offset=0, SizeType count=Everything)
 
static String FromUtf8 (Utf8Array const &utf8, SizeType offset=0, SizeType count=Everything)
 
static String Join (Collections::IList< String > const &values, String const &separator)
 

Friends

class Ascii
 
class StringBuilder
 

Usage Description

T As ( ) const
inline

Gets the value as the specified type. If the value of this instance cannot be converted, then a default-initialized value of the type is returned. Also consider using String::TryConvert().

Char16 CharAt ( SizeType  offset) const

Gets the code unit at the specified offset.

Char32 CodePointAt ( SizeType  offset) const

Gets the code point that contains the specified code unit offset.

SizeType CodePointIndex ( SizeType  offset) const

Returns the code unit offset of the start of the code point that contains the specified code unit offset.

SizeType CodePointIndexNext ( SizeType  offset) const

Returns the code unit offset of the start of the code point after the one containing the specified code unit offset. Will return Length() if offset is contained in the last code point.

SizeType CodePointIndexPrev ( SizeType  offset) const

Returns the code unit offset of the start of the code point before the one containing the specified code unit offset. Will return 0 if offset is contained in the first code point.

SizeType CodePointLength ( SizeType  offset = 0,
SizeType  count = Everything 
) const

Gets length of string, in code points starting at the specified code unit offset and including at most count code units. Returns 0 if string is empty or null.

int Compare ( String const &  other,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Compares this instance with the other instance by code unit, starting at the specified offset for count characters.

int CompareNoCase ( String const &  other,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Compares instance with the other instance by code unit, starting at the specified offset for count characters. The comparison is case-sensitive.

String Concatenate ( char const *  other,
SizeType  count = Everything 
) const

Returns the concatenation of this instance and the specified ASCII string.

String Concatenate ( String const &  other) const

Returns the concatenation of this instance and the specified string.

String Concatenate ( Char16  other) const

Returns the concatenation of this instance and the specified code unit.

String Concatenate ( AsciiArray const &  other) const

Returns the concatenation of this instance and the specified ASCII characters.

String Concatenate ( Utf16Array const &  other) const

Returns the concatenation of this instance and the specified code units.

String Concatenate ( Utf32Array const &  other) const

Returns the concatenation of this instance and the specified code points.

bool Contains ( String const &  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Returns a boolean value that indicates whether the current instance contains the specified offset for count characters, starting at the specified offset.

bool Contains ( Char16  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Returns a boolean value that indicates whether the current instance contains the specified code unit, starting at the specified offset for count characters.

virtual void Deserialize ( SerializationInfo const &  info)
virtual
static String const& Empty ( )
inlinestatic

Gets an instance of an empty string.

ByteArray Encode ( String const &  encodingName) const

Encodes the string using the specified encoding name.

ByteArray Encode ( Text::Encoding encoding) const

Encodes the string using the specified encoding. Implicitly resets the encoding's encoder.

AsciiArray EncodeSystem ( ) const

Encodes the string using the system default encoding. This is useful for interoperation with system-level API calls. The backing memory will include a terminating NULL, but the NULL is not included within the bounds of the returned array.

bool EndsWith ( String const &  value) const

Determines whether the string ends with the specified string.

bool EndsWith ( Char16  value) const

Determines whether the string ends with the specified code unit.

String Escape ( ) const

Performs the inverse of Unescape.

String FoldCase ( ) const

Returns a copy of the string that is case folded. Case folding is locale-independent and not context-sensitive.

static Nullable<String> From ( T const &  value)
inlinestatic
static String FromAscii ( char const *  pSrc,
SizeType  count = Everything 
)
static

Converts an ASCII string directly to a Unicode string. The value of each ASCII character is directly mapped to a Unicode character with the same ordinal value. Thus it is only useful for "invariant characters" that are encoded in the default platform source file encoding.

static String FromAsciiFoldCase ( char const *  pSrc,
SizeType  count = Everything 
)
inlinestatic

Returns a case-folded version of the specifed ASCII string.

static String FromEncoding ( String const &  encodingName,
ByteArray const &  bytes,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Converts from a byte array using the specified encoding name.

static String FromEncoding ( Text::Encoding encoding,
ByteArray const &  bytes,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Converts from a byte array using the specified encoding.

static String FromEscapedAscii ( char const *  pSrc,
SizeType  count = Everything 
)
static

Unescapes a string of characters and returns the resulting Unicode string. The following escape sequences are recognized:

\uhhhh 4 hex digits; h in [0-9A-Fa-f] \Uhhhhhhhh 8 hex digits \xhh 1-2 hex digits \x{h...} 1-8 hex digits \ooo 1-3 octal digits; o in [0-7] \cX control-X; X is masked with 0x1F

as well as the standard ANSI C escapes:

\a => U+0007, \b => U+0008, \t => U+0009, \n => U+000A, \v => U+000B, \f => U+000C, \r => U+000D, \e => U+001B, \" => U+0022, \' => U+0027, \? => U+003F, \\ => U+005C

Anything else following a backslash is generically escaped. For example, "[a\\-z]" returns "[a-z]".

If an escape sequence is ill-formed, this method returns a null string. An example of an ill-formed sequence is "\\u" followed by fewer than 4 hex digits.

The above characters are recognized in the compiler's codepage, that is, they are coded as 'u', '\', etc. Characters that are not parts of escape sequences are converted as if using FromAscii().

static String FromLatin1 ( ByteArray const &  latin1,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Converts from Latin-1. Invalid content will be replaced with U+FFFD.

static String FromUtf16 ( Utf16Array const &  utf16,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Constructs from UTF16. Invalid content will be replaced with U+FFFD.

static String FromUtf32 ( Utf32Array const &  utf32,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Converts from UTF32. Invalid content will be replaced with U+FFFD.

static String FromUtf8 ( Utf8Array const &  utf8,
SizeType  offset = 0,
SizeType  count = Everything 
)
static

Converts from a UTF8 byte array. Invalid content will be replaced with U+FFFD.

Collections::EnumeratorT<Char32> GetCodePointEnumerator ( ) const

Gets an enumerator over all the code points in the string.

Collections::EnumeratorT<String> GetGraphemeEnumerator ( ) const

Gets an enumerator over all the graphemes in the string.

HashCode GetHashCode ( ) const
inline

Returns this instance, expressed as a hashcode.

Collections::EnumeratorT<Char32> GetReverseCodePointEnumerator ( ) const

Gets an enumerator over all the code points in the string, in reverse order.

SizeType IndexOf ( Char16  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the first occurence of the specified code unit, starting at specified offset for count characters. Returns Invalid if the value cannot be found.

SizeType IndexOf ( String const &  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the first occurence of the specified string, starting at specified offset for count characters. Returns Invalid if value cannot be found, or this instance is empty. Returns 0 if the value is empty.

SizeType IndexOf ( Utf16Array const &  seq,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the first occurrence of code unit sequence, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

SizeType IndexOfAny ( String const &  chars,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the first occurrence of one of the characters in the specified string, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

SizeType IndexOfAny ( Char16Array const &  chars,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the first occurrence of one of the specified code units, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

bool IsEmpty ( ) const
inline

Returns a boolean value that indicates whether the current string is empty. Returns true if the string is empty or null.

bool IsNormalized ( UnicodeNormalizationForm::Enum  normalizationForm = UnicodeNormalizationForm::Compose) const

Returns a boolean value that indicates whether the current instance is normalized according to the specified form, which defaults to NFC (Compose) normalization form. See http://www.unicode.org/reports/tr15/ for details on the various normalization forms.

String Join ( Collections::IList< String > const &  values) const

Creates a new String that contains the concatenation of 'values' separated by this string.

static String Join ( Collections::IList< String > const &  values,
String const &  separator 
)
static

Creates a new String that contains the concatenation of 'values' separated by 'separator'.

SizeType LastIndexOf ( Char16  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the last occurence of code point, starting at specified offset for count characters. Returns Invalid if the value cannot be found.

SizeType LastIndexOf ( String const &  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the last occurence of the specified string, starting at specified offset for count characters. Returns Invalid if the value cannot be found, or this instance is empty. Return the last character index if the value is empty.

SizeType LastIndexOf ( Utf16Array const &  seq,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the last occurrence of code point sequence, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

SizeType LastIndexOfAny ( String const &  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the last occurrence of one of the characters in the specified string, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

SizeType LastIndexOfAny ( Char16Array const &  value,
SizeType  offset = 0,
SizeType  count = Everything 
) const

Finds the last occurrence of one of the specified code units, starting at specified offset for count characters. Returns Invalid if a match cannot be found.

SizeType Length ( ) const
inline

Gets length of string, in code units. Returns 0 if string is empty or null.

Normalizes the unicode string. Uses NFC (Compose) normalization form as default. See http://www.unicode.org/reports/tr15/ for details on the various normalization forms.

bool operator!= ( String const &  other) const
inline

Checks whether the current instance is equal to the specified other instance. Returns true if they are not equal, otherwise returns false.

String operator+ ( char const *  other) const
inline

Concatenation operator.

String operator+ ( String const &  other) const
inline

Concatenation operator.

String operator+ ( Char16  other) const
inline

Concatenation operator.

String operator+ ( AsciiArray const &  other) const
inline

Concatenation operator.

String operator+ ( Utf16Array const &  other) const
inline

Concatenation operator.

String operator+ ( Utf32Array const &  other) const
inline

Concatenation operator.

String& operator+= ( char const *  other)
inline

Concatenation operator.

String& operator+= ( String const &  other)
inline

Concatenation operator.

String& operator+= ( Char16  other)
inline

Concatenation operator.

String& operator+= ( AsciiArray const &  other)
inline

Concatenation operator.

String& operator+= ( Utf16Array const &  other)
inline

Concatenation operator.

String& operator+= ( Utf32Array const &  other)
inline

Concatenation operator.

bool operator< ( String const &  other) const
inline

Checks if the current instance is less than the specified other instance; returns true if it is, otherwise returns false.

bool operator<= ( String const &  other) const
inline

Checks if the current instance is less than or equal to the specified other instance; returns true if it is, otherwise returns false.

String& operator= ( char  value)
inline

Assigns the specified value to the current instance.

String& operator= ( Char16  value)
inline

Assigns the specified value to the current instance.

String& operator= ( Char32  value)
inline

Assigns the specified value to the current instance.

String& operator= ( char const *  pszValue)
inline

Assigns the specified value to the current instance.

String& operator= ( const std::string &  value)
inline

Assigns the specified value to the current instance.

String& operator= ( Utf8Array const &  value)
inline

Assigns the specified value to the current instance.

String& operator= ( AsciiArray const &  value)
inline

Assigns the specified value to the current instance.

String& operator= ( Utf16Array const &  value)
inline

Assigns the specified value to the current instance.

String& operator= ( Utf32Array const &  value)
inline

Assigns the specified value to the current instance.

String& operator= ( StringBuffer const &  value)
inline

Assigns the specified value to the current instance.

bool operator== ( String const &  other) const
inline

Checks whether the current instance is equal to the specified other instance. Returns true if they are equal, otherwise returns false.

bool operator> ( String const &  other) const
inline

Checks if the current instance is greater than the specified other instance; returns true if it is, otherwise returns false.

bool operator>= ( String const &  other) const
inline

Checks if the current instance is greater than or equal to the specified other instance; returns true if it is, otherwise returns false.

Char16 operator[] ( SizeType  offset) const
inline

Gets the code unit at the specified offset.

bool ReferenceEquals ( String const &  other) const
inline
String Replace ( Char16  value,
Char16  replacement 
) const

Returns a new String instance with all occurrences of the code unit replaced with the specified replacement code unit.

String Replace ( Char16  value,
String const &  replacement 
) const

Returns a new String instance with all occurrences of the code unit replaced with the specified replacement string.

String Replace ( String const &  value,
String const &  replacement 
) const

Returns a new String instance with all occurrences of the string replaced with the specified replacement string.

String Replace ( String const &  value,
Char16  replacement 
) const

Returns a new String instance with all occurrences of the string replaced with the specified replacement character.

String ReplaceRange ( SizeType  offset,
SizeType  count,
String const &  replacement 
) const

Returns a new String instance with the specified range of characters replaced with the specified replacement string.

String Reverse ( SizeType  start = 0,
SizeType  count = Everything 
) const

Returns a copy of the specified substring with the order of the characters reversed.

virtual void Serialize ( SerializationInfo &  info) const
virtual
Collections::List<String> Split ( Char16  delimiter,
bool  removeEmpty = true,
SizeType  offset = 0,
SizeType  maxValues = Everything 
) const

Splits the string using the specified code unit delimiter. Optionally specifies whether empty results should be removed.

Collections::List<String> Split ( String const &  delimiter,
bool  removeEmpty = true,
SizeType  offset = 0,
SizeType  maxValues = Everything 
) const

Splits the string using the specified string as a delimiter. Optionally specifies whether empty results should be removed.

Collections::List<String> Split ( Char16Array const &  delimiters,
bool  removeEmpty = true,
SizeType  offset = 0,
SizeType  maxValues = Everything 
) const

Splits the string using any of the code units in the specified delimiter array. Optionally specifies whether empty results should be removed.

bool StartsWith ( String const &  value) const

Determines whether the string starts with the specified string.

bool StartsWith ( Char16  value) const

Determines whether the string starts with the specified code unit.

String Substring ( SizeType  start = 0,
SizeType  count = Everything 
) const

Returns the specified substring.

AsciiArray ToAscii ( char  substitution = '_') const

As an invariant ASCII-encoded array. The backing memory will include a terminating NULL, but the NULL is not included within the bounds of the returned array. Any non-invariant characters are replaced with _ by default.

ByteArray ToLatin1 ( ) const

As latin-1 encoded unsigned characters. The backing memory will including a terminating NULL, but the NULL is not included within the bounds of the returned array.

String ToLower ( Locale const &  locale) const

Returns a copy of the string converted to lower case.

std::string ToStdUtf8 ( )

Convert String to a std::string with UTF8 encoding.

String ToTitle ( Locale const &  locale) const

Returns a copy of the string converted to title case.

String ToUpper ( Locale const &  locale) const

Returns a copy of the string converted to upper case.

Utf16Array ToUtf16 ( ) const
inline

As a code unit array; a copy of the internal data is made.

const Utf16Array ToUtf16NoCopy ( ) const

As a read-only code unit array; no copy of the internal data is made.

Utf32Array ToUtf32 ( Char32  substitution = Char32(0xFFFD)) const

As a code point array. Unpaired surrogates are substituted with U+FFFD (replacement character).

Utf8Array ToUtf8 ( Char32  substitution = Char32(0xFFFD)) const

As a UTF8 array. The backing memory will include a terminating NULL, but the NULL is not included within the bounds of the returned array. Unpaired surrogates are substituted with U+FFFD (replacement character).

String Trim ( String const &  chars = String::Empty()) const

Returns a copy of the current string with the specified chars trimmed from the start and end. If chars is not specified, all whitespace characters are removed.

String TrimEnd ( String const &  chars = String::Empty()) const

Returns a copy of the current string with the specified chars trimmed from the end. If chars is not specified, all whitespace characters are removed.

String TrimStart ( String const &  chars = String::Empty()) const

Returns a copy of the current string with the specified chars trimmed from the start. If chars is not specified, all whitespace characters are removed.

bool TryConvert ( T &  result) const

Tries to convert the current string to an instance of the specified type value.

String Unescape ( ) const

Returns an unescaped version of the current instance. The following escape sequences are recognized:

\uhhhh 4 hex digits; h in [0-9A-Fa-f] \Uhhhhhhhh 8 hex digits \xhh 1-2 hex digits \x{h...} 1-8 hex digits \ooo 1-3 octal digits; o in [0-7] \cX control-X; X is masked with 0x1F

as well as the standard ANSI C escapes:

\a => U+0007, \b => U+0008, \t => U+0009, \n => U+000A, \v => U+000B, \f => U+000C, \r => U+000D, \e => U+001B, \" => U+0022, \' => U+0027, \? => U+003F, \\ => U+005C

Anything else following a backslash is generically escaped. For example, "[a\\-z]" returns "[a-z]".

If an escape sequence is ill-formed, this method returns a null string. An example of an ill-formed sequence is "\\u" followed by fewer than 4 hex digits.

The above characters are recognized in the compiler's codepage, that is, they are coded as 'u', '\', etc. Characters that are not parts of escape sequences are converted as if using FromAscii().

Friends And Related Function Documentation

friend class Ascii
friend
friend class StringBuilder
friend