StringTemplate< INTERFACETYPE, REFTYPE, CHARTYPE > Class Template Reference 系统

#include <string.h>

详细描述

template<typename INTERFACETYPE, typename REFTYPE, typename CHARTYPE>
class maxon::StringTemplate< INTERFACETYPE, REFTYPE, CHARTYPE >

Base template for String and CString .

Template Parameters
INTERFACETYPE Either String or CString .
REFTYPE Reference of the interface ( String or CString ).
CHARTYPE 数据 type to store characters, either Utf32Char ( String ) or Char ( CString ).

Classes

class   CharPtr

Public Types

using  Super = StringTemplate

公共成员函数

MAXON_METHOD Int   GetLength () const
MAXON_METHOD Result < void >  Init ( Int count=0, CHARTYPE fillChar=0)
MAXON_METHOD Result < void >  Shrink ()
MAXON_METHOD Result < void >  Append (const INTERFACETYPE *str)
MAXON_METHOD Result < void >  Append (const CHARTYPE *str, Int len)
MAXON_FUNCTION Result < void >  AppendChar (CHARTYPE v)
MAXON_METHOD Int   FindIndex (const INTERFACETYPE *str, StringPosition start=0) const
MAXON_METHOD Int   FindLastIndex (const INTERFACETYPE *str, StringPosition start= StringEnd ()) const
MAXON_METHOD Int   FindIndex (CHARTYPE ch, StringPosition start=0) const
MAXON_METHOD Int   FindLastIndex (CHARTYPE ch, StringPosition start= StringEnd ()) const
MAXON_METHOD Int   FindUpperIndex (const INTERFACETYPE *str, StringPosition start=0) const
MAXON_METHOD Int   FindLastUpperIndex (const INTERFACETYPE *str, StringPosition start= StringEnd ()) const
MAXON_METHOD Result < void >  Erase ( StringPosition position, StringCount count)
MAXON_METHOD Result < void >  Insert ( StringPosition position, const INTERFACETYPE *str, StringPosition strStart=0, StringCount strCount= StringEnd ())
MAXON_METHOD Result < void >  Insert ( StringPosition position, CHARTYPE ch)
MAXON_METHOD INTERFACETYPE *  GetPart ( StringPosition start, StringCount count) const
MAXON_METHOD INTERFACETYPE *  ToUpper () const
MAXON_METHOD INTERFACETYPE *  ToLower () const
MAXON_METHOD COMPARERESULT   ComparePart (const INTERFACETYPE *str, STRINGCOMPARISON 模式, StringPosition position, StringCount count) const
MAXON_FUNCTION COMPARERESULT   比较 (const INTERFACETYPE *str, STRINGCOMPARISON mode= STRINGCOMPARISON::UNICODE_NUMBERS ) const
MAXON_FUNCTION Bool   IsEqual (const INTERFACETYPE *str) const
MAXON_METHOD HashInt   GetHashCode () const
MAXON_METHOD void  SetChar ( Int pos, CHARTYPE ch)
MAXON_METHOD CHARTYPE  GetChar ( Int pos) const
MAXON_FUNCTION Result < Float64 ToFloat64 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < Float32 ToFloat32 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < Float ToFloat ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < Int64 ToInt64 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < Int32 ToInt32 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < Int ToInt ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < UInt64 ToUInt64 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < UInt32 ToUInt32 ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION Result < UInt ToUInt ( STRINGCONVERSION flags= STRINGCONVERSION::NONE ) const
MAXON_FUNCTION INTERFACETYPE *  AppendInt ( Int32 v)
MAXON_FUNCTION INTERFACETYPE *  AppendUInt ( UInt32 v)
MAXON_FUNCTION INTERFACETYPE *  AppendInt ( Int64 v)
MAXON_FUNCTION INTERFACETYPE *  AppendUInt ( UInt64 v)
MAXON_METHOD Result < void >  GetUtf32 ( Utf32CharBuffer &stringData) const
MAXON_METHOD Result < void >  TrimLeft ()
MAXON_METHOD Result < void >  TrimRight ()
MAXON_METHOD Result < void >  Split (const REFTYPE &splitSymbol, Bool trim, const ValueReceiver < const REFTYPE & > &parts) const
MAXON_METHOD Result < Int 替换 (CHARTYPE find, CHARTYPE replace)
MAXON_METHOD Result < Int 替换 (const REFTYPE &find, const REFTYPE &replace)
MAXON_METHOD Result < Int 替换 (CHARTYPE find, const REFTYPE &replace)
MAXON_FUNCTION Bool   Find (const REFTYPE &str, Int *pos, StringPosition start=0) const
MAXON_FUNCTION Bool   FindLast (const REFTYPE &str, Int *pos, StringPosition start= StringEnd ()) const
MAXON_FUNCTION Bool   Find (CHARTYPE ch, Int *pos, StringPosition start=0) const
MAXON_FUNCTION Bool   FindLast (CHARTYPE ch, Int *pos, StringPosition start= StringEnd ()) const
MAXON_FUNCTION Bool   FindUpper (const REFTYPE &str, Int *pos, StringPosition start=0) const
MAXON_FUNCTION Bool   FindLastUpper (const REFTYPE &str, Int *pos, StringPosition start= StringEnd ()) const
MAXON_FUNCTION INTERFACETYPE *  GetLeftPart ( StringPosition start) const
MAXON_FUNCTION INTERFACETYPE *  GetRightPart ( StringPosition start) const
MAXON_FUNCTION Bool   StartsWith (CHARTYPE ch) const
MAXON_FUNCTION Bool   StartsWith (const REFTYPE &str) const
MAXON_FUNCTION Bool   EndsWith (CHARTYPE ch) const
MAXON_FUNCTION Bool   EndsWith (const REFTYPE &str) const
MAXON_FUNCTION Result < void >  Trim ()

静态公共成员函数

static MAXON_FUNCTION REFTYPE  FloatToString ( Float32 value, Int charsBeforeComma= STRING_DYNAMIC_DIGITS , Int digitsAfterComma=-3, Bool exponent=false, CHARTYPE fillChar=' ')
static MAXON_FUNCTION REFTYPE  FloatToString ( Float64 value, Int charsBeforeComma= STRING_DYNAMIC_DIGITS , Int digitsAfterComma=-3, Bool exponent=false, CHARTYPE fillChar=' ')
static MAXON_FUNCTION REFTYPE  IntToString ( Int32 v)
static MAXON_FUNCTION REFTYPE  UIntToString ( UInt32 v)
static MAXON_FUNCTION REFTYPE  IntToString ( Int64 v)
static MAXON_FUNCTION REFTYPE  UIntToString ( UInt64 v)
static MAXON_FUNCTION REFTYPE  MemorySizeToString ( Int64 v, Bool mebibytes=true)
static MAXON_FUNCTION REFTYPE  HexToString ( UInt32 v, Bool prefix0x=true)
static MAXON_FUNCTION REFTYPE  HexToString ( UInt64 v, Bool prefix0x=true)
static MAXON_FUNCTION REFTYPE  PointerToString (const void *v)

Member Typedef Documentation

◆  Super

using Super = StringTemplate

成员函数文档编制

◆  GetLength()

MAXON_METHOD Int GetLength ( ) const

Returns the length (number of elements) of the string, not the size of the block.

◆  Init()

MAXON_METHOD Result <void> Init ( Int   count = 0 ,
CHARTYPE  fillChar = 0  
)

Initializes the string with a specific length and a default character.

参数
[in] count Number of characters of the new string.
[in] fillChar Character to fill the string with.
返回
OK on success.

◆  Shrink()

MAXON_METHOD Result <void> Shrink ( )

Optimizes the memory usage. This can only be done if the string previously contained 16- or 32-bit Unicode characters that now have been removed or if the string was longer before.

返回
OK on success. Also returns OK if the string already is in its smallest state.

◆  Append() [1/2]

MAXON_METHOD Result <void> Append ( const INTERFACETYPE *  str )

Concatenates 2 strings, use this operation instead of a = a + b as it is much faster.

返回
OK on success.

◆  Append() [2/2]

MAXON_METHOD Result <void> Append ( const CHARTYPE *  str ,
Int   len  
)

Concatenates 2 strings of which the second is represented by len characters at address str in memory.

参数
[in] str Character pointer.
[in] len Number of characters.
返回
OK on success.

◆  AppendChar()

MAXON_FUNCTION Result <void> AppendChar ( CHARTYPE  v )

Appends a character to the current string.

参数
[in] v The character that will be added.
返回
OK on success.

◆  FindIndex() [1/2]

MAXON_METHOD Int FindIndex ( const INTERFACETYPE *  str ,
StringPosition   start = 0  
) const

Searches for the first occurrence of 'str' within a string.

参数
[in] str The search string.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'str' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  FindLastIndex() [1/2]

MAXON_METHOD Int FindLastIndex ( const INTERFACETYPE *  str ,
StringPosition   start = StringEnd()  
) const

Searches for the last occurrence of 'str' within a string.

参数
[in] str The search string.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'str' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  FindIndex() [2/2]

MAXON_METHOD Int FindIndex ( CHARTYPE  ch ,
StringPosition   start = 0  
) const

Searches for the first occurrence of character 'ch' within a string.

参数
[in] ch The search character.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'ch' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  FindLastIndex() [2/2]

MAXON_METHOD Int FindLastIndex ( CHARTYPE  ch ,
StringPosition   start = StringEnd()  
) const

Searches for the last occurrence of character 'ch' within a string.

参数
[in] ch The search character.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'ch' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  FindUpperIndex()

MAXON_METHOD Int FindUpperIndex ( const INTERFACETYPE *  str ,
StringPosition   start = 0  
) const

Uppercase search for the first occurrence of 'str' within a string (which doesn't need to contain uppercase characters).

参数
[in] str The search string, must be completely uppercase, otherwise no matches will be found.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'str' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  FindLastUpperIndex()

MAXON_METHOD Int FindLastUpperIndex ( const INTERFACETYPE *  str ,
StringPosition   start = StringEnd()  
) const

Uppercase search for the last occurrence of 'str' within a string (which doesn't need to contain uppercase characters).

参数
[in] str The search string, must be completely uppercase, otherwise no matches will be found.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return InvalidArrayIndex.
返回
The index at which 'str' has been found or InvalidArrayIndex. @MAXON_ANNOTATION{default=InvalidArrayIndex}

◆  Erase()

MAXON_METHOD Result <void> Erase ( StringPosition   position ,
StringCount   count  
)

Erases a range of characters within a string.

参数
[in] position The starting position to delete 'count' characters. If the position is out of bounds an error will be returned.
[in] count Number of characters to delete. If you want to delete all characters until the end pass StringEnd(). If the number is larger than what is available an error will be returned.
返回
OK on success.

◆  Insert() [1/2]

MAXON_METHOD Result <void> Insert ( StringPosition   position ,
const INTERFACETYPE *  str ,
StringPosition   strStart = 0 ,
StringCount   strCount = StringEnd()  
)

Inserts a string at a specific position.

参数
[in] position Insert position in the current string. StringEnd() is a valid position. If the position is out of bounds an error is returned.
[in] str String to be inserted.
[in] strStart Starting position of the string to be inserted. If the position is out of bounds an error is returned.
[in] strCount Number of characters to be inserted. If the number of characters is too large an error is returned.
返回
OK on success.

◆  Insert() [2/2]

MAXON_METHOD Result <void> Insert ( StringPosition   position ,
CHARTYPE  ch  
)

Inserts a single unicode character at a specific position.

参数
[in] position Insert position, needs to be within boundaries.
[in] ch Unicode character to insert.
返回
OK on success.

◆  GetPart()

MAXON_METHOD INTERFACETYPE* GetPart ( StringPosition   start ,
StringCount   count  
) const

Creates a part of the current string.

参数
[in] start Position where the new partial string will start.
[in] count Number of characters for the partial string. If it is larger than the number of available characters an empty string will be returned.
返回
The partial string, or empty string if 'start' was out of boundaries. Will be an empty reference if GetPart fails (apply iferr for error handling).

◆  ToUpper()

MAXON_METHOD INTERFACETYPE* ToUpper ( ) const

Returns the uppercase version of a string.

返回
Uppercase version of a string. Will be an empty reference if ToUpper fails (apply iferr for error handling).

◆  ToLower()

MAXON_METHOD INTERFACETYPE* ToLower ( ) const

Returns the lowercase version of a string.

返回
Lowercase version of a string. Will be an empty reference if ToLower fails (apply iferr for error handling).

◆  ComparePart()

MAXON_METHOD COMPARERESULT ComparePart ( const INTERFACETYPE *  str ,
STRINGCOMPARISON   mode ,
StringPosition   position ,
StringCount   count  
) const

Compares a part of this against 'str' for exact match. Example:

"abcdefghijk" _s.ComparePart( "bcd" _s, STRINGCOMPARISON::MEMORY ,1,3);

returns COMPARESTRING::EQUAL for matching "bcd"

参数
[in] str Comparison object.
[in] mode Comparison mode.
[in] position Starting position in the current string that 'str' will be compared against. The interval [position..count] will be clipped against valid boundaries.
[in] count Number of characters in the current string that 'str' will be compared against. count can be longer than the string length and will be clipped accordingly.
返回
See COMPARERESULT.

◆  Compare()

MAXON_FUNCTION COMPARERESULT 比较 ( const INTERFACETYPE *  str ,
STRINGCOMPARISON   mode = STRINGCOMPARISON::UNICODE_NUMBERS  
) const

Compares the object against 'str' for exact match.

参数
[in] str Comparison object.
[in] mode Comparison mode.
返回
See COMPARERESULT.

◆  IsEqual()

MAXON_FUNCTION Bool IsEqual ( const INTERFACETYPE *  str ) const

Compare strings for equality.

返回
True if equal.

◆  GetHashCode()

MAXON_METHOD HashInt GetHashCode ( ) const

◆  SetChar()

MAXON_METHOD void SetChar ( Int   pos ,
CHARTYPE  ch  
)

Changes the character at the given position (used internally by CharPtr ).

参数
[in] pos Character index. If it is negative the position is relative to end, e.g. -1 indicates the last character. The position must be within boundaries, however only a debug assert will happen otherwise.
[in] ch Character value.

@MAXON_ANNOTATION{refclass=false}

◆  GetChar()

MAXON_METHOD CHARTYPE GetChar ( Int   pos ) const

Retrieves the character at a given position. If the position is out of bounds 0 will be returned.

参数
[in] pos Character position. If it is negative the position is relative to end, e.g. -1 indicates the last character. The position must be within boundaries, however only a debug assert will happen otherwise.
返回
The character.

@MAXON_ANNOTATION{refclass=false}

◆  ToFloat64()

MAXON_FUNCTION Result < Float64 > ToFloat64 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 64-bit floating point value. This routine does no formula parsing. While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Floating point value of the string.

◆  ToFloat32()

MAXON_FUNCTION Result < Float32 > ToFloat32 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 32-bit floating point value. This routine does no formula parsing. While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Floating point value of the string.

◆  ToFloat()

MAXON_FUNCTION Result < Float > ToFloat ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a floating point value. This routine does no formula parsing. While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Floating point value of the string.

◆  ToInt64()

MAXON_FUNCTION Result < Int64 > ToInt64 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 64 bit integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  ToInt32()

MAXON_FUNCTION Result < Int32 > ToInt32 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 32 bit integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  ToInt()

MAXON_FUNCTION Result < Int > ToInt ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to an integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  ToUInt64()

MAXON_FUNCTION Result < UInt64 > ToUInt64 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 64 bit unsigned integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  ToUInt32()

MAXON_FUNCTION Result < UInt32 > ToUInt32 ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to a 32 bit unsigned integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  ToUInt()

MAXON_FUNCTION Result < UInt > ToUInt ( STRINGCONVERSION   flags = STRINGCONVERSION::NONE ) const

Converts a string to an unsigned integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.

参数
[in] flags Optional flags for the conversion.
返回
Integer value of the string.

◆  FloatToString() [1/2]

static MAXON_FUNCTION REFTYPE FloatToString ( Float32   value ,
Int   charsBeforeComma = STRING_DYNAMIC_DIGITS ,
Int   digitsAfterComma = -3 ,
Bool   exponent = false ,
CHARTYPE  fillChar = ' '  
)
static

Converts a floating point value into formatted text.

参数
[in] value Floating point value to convert into text.
[in] charsBeforeComma Characters before the decimal point. If STRING_DYNAMIC_DIGITS is passed or 'charsBeforeComma' is too low to represent 'value' it is automatically increased/adjusted. If 'charsBeforeComma' is positive and exponent is false fill characters will be added to the beginning. If STRING_MAXIMUM_PRECISION is passed, then the result will be an exact representation of the value (possibly using exponential notation).
[in] digitsAfterComma Digits after the decimal point. If a negative number is passed the number of digits is automatically chosen and up to (-digitsAfterComma).
[in] exponent Force exponential-style output (e.g. 1.0e+10).
[in] fillChar Fill character for digits before the decimal point. E.g. if you specify 4 for charsBeforeComma, '*' for fillChar and your value is 1.5 you'll get ***1.5 as a result. This value has no impact if exponent is true.
返回
String object with the decimal text of the value.

◆  FloatToString() [2/2]

static MAXON_FUNCTION REFTYPE FloatToString ( Float64   value ,
Int   charsBeforeComma = STRING_DYNAMIC_DIGITS ,
Int   digitsAfterComma = -3 ,
Bool   exponent = false ,
CHARTYPE  fillChar = ' '  
)
static

Converts a floating point value into formatted text.

参数
[in] value Floating point value to convert into text.
[in] charsBeforeComma Characters before the decimal point. If STRING_DYNAMIC_DIGITS is passed or 'charsBeforeComma' is too low to represent 'value' it is automatically increased/adjusted. If 'charsBeforeComma' is positive and exponent is false fill characters will be added to the beginning. If STRING_MAXIMUM_PRECISION is passed, then the result will be an exact representation of the value (possibly using exponential notation).
[in] digitsAfterComma Digits after the decimal point. If a negative number is passed the number of digits is automatically chosen and up to (-digitsAfterComma).
[in] exponent Force exponential-style output (e.g. 1.0e+10).
[in] fillChar Fill character for digits before the decimal point. E.g. if you specify 4 for charsBeforeComma, '*' for fillChar and your value is 1.5 you'll get ***1.5 as a result. This value has no impact if exponent is true.
返回
String object with the decimal text of the value.

◆  AppendInt() [1/2]

MAXON_FUNCTION INTERFACETYPE* AppendInt ( Int32   v )

Appends a number to the current string.

参数
[in] v The number that will be added.
返回
The current string. Will be an empty reference if AppendInt fails (apply iferr for error handling). @MAXON_ANNOTATION{returnsThis,noResult}

◆  AppendUInt() [1/2]

MAXON_FUNCTION INTERFACETYPE* AppendUInt ( UInt32   v )

Appends a number to the current string.

参数
[in] v The number that will be added.
返回
The current string. Will be an empty reference if AppendUInt fails (apply iferr for error handling). @MAXON_ANNOTATION{returnsThis,noResult}

◆  AppendInt() [2/2]

MAXON_FUNCTION INTERFACETYPE* AppendInt ( Int64   v )

Appends a number to the current string.

参数
[in] v The number that will be added.
返回
The current string. Will be an empty reference if AppendInt fails (apply iferr for error handling). @MAXON_ANNOTATION{returnsThis,noResult}

◆  AppendUInt() [2/2]

MAXON_FUNCTION INTERFACETYPE* AppendUInt ( UInt64   v )

Appends a number to the current string.

参数
[in] v The number that will be added.
返回
The current string. Will be an empty reference if AppendUInt fails (apply iferr for error handling). @MAXON_ANNOTATION{returnsThis,noResult}

◆  IntToString() [1/2]

static MAXON_FUNCTION REFTYPE IntToString ( Int32   v )
static

Formats a Int32 value as decimal text.

参数
[in] v Int32 value.
返回
String object with the decimal text of the value. Will be an empty reference on failure (apply iferr for error handling).

◆  UIntToString() [1/2]

static MAXON_FUNCTION REFTYPE UIntToString ( UInt32   v )
static

Formats a UInt32 value as decimal text.

参数
[in] v UInt32 value.
返回
String object with the decimal text of the value. Will be an empty reference on failure (apply iferr for error handling).

◆  IntToString() [2/2]

static MAXON_FUNCTION REFTYPE IntToString ( Int64   v )
static

Formats a Int64 value as decimal text.

参数
[in] v Int64 value.
返回
String object with the decimal text of the value. Will be an empty reference on failure (apply iferr for error handling).

◆  UIntToString() [2/2]

static MAXON_FUNCTION REFTYPE UIntToString ( UInt64   v )
static

Formats a UInt64 value as decimal text.

参数
[in] v Int64 value.
返回
String object with the decimal text of the value. Will be an empty reference on failure (apply iferr for error handling).

◆  MemorySizeToString()

static MAXON_FUNCTION REFTYPE MemorySizeToString ( Int64   v ,
Bool   mebibytes = true  
)
static

Formats a Int64 value as a memory information.

参数
[in] v The size of bytes that should be formated as memory text.
[in] mebibytes defines if a value of 1343443 is either output as "1.28 MiB" (mebibytes) or "1.34 MB" (megabytes).
返回
String object for the given mem value.

◆  HexToString() [1/2]

static MAXON_FUNCTION REFTYPE HexToString ( UInt32   v ,
Bool   prefix0x = true  
)
static

Formats a Int32 value as hexadecimal text.

参数
[in] v Int32 value.
[in] prefix0x Start the string with 0x as prefix.
返回
String object with the hexadecimal text of the value.

◆  HexToString() [2/2]

static MAXON_FUNCTION REFTYPE HexToString ( UInt64   v ,
Bool   prefix0x = true  
)
static

Formats a Int64 value as hexadecimal text.

参数
[in] v Int64 value.
[in] prefix0x Start the string with 0x as prefix.
返回
String object with the hexadecimal text of the value.

◆  PointerToString()

static MAXON_FUNCTION REFTYPE PointerToString ( const void *  v )
static

Formats a pointer as hexadecimal text. The pointer starts with 0x prefix.

参数
[in] v Pointer to convert.
返回
String object with the hexadecimal text of the value.

◆  GetUtf32()

MAXON_METHOD Result <void> GetUtf32 ( Utf32CharBuffer stringData ) const

Copies the string as UTF-32 encoded characters into the passed array. The array will be resized and contain the non \0 - terminated data.

参数
[out] stringData The array to receive the data.
返回
OK on success.

◆  TrimLeft()

MAXON_METHOD Result <void> TrimLeft ( )

Removes all characters with value <= 0x20 (e.g. space, tab, line feed) at the beginning of the string.

返回
OK on success.

◆  TrimRight()

MAXON_METHOD Result <void> TrimRight ( )

Removes all characters with value <= 0x20 (e.g. space, tab, line feed) at the end of the string.

返回
OK on success.

◆  Split()

MAXON_METHOD Result <void> Split ( const REFTYPE &  splitSymbol ,
Bool   trim ,
const ValueReceiver < const REFTYPE & > &  parts  
) const

Splits the string into parts separated by the split symbol (e.g. a comma).

参数
[in] splitSymbol String containing the split symbol.
[in] trim If true each separated part will be trimmed (see Trim).
[out] parts Array to be filled with the separated strings.
返回
OK on success.

◆  Replace() [1/3]

MAXON_METHOD Result < Int > Replace ( CHARTYPE  find ,
CHARTYPE  replace  
)

Replaces all occurrences of the character 'find' in the current string with the given character 'replace'.

参数
[in] find Search character. Each occurrence will be replaced with 'replace'.
[in] replace Replacement of 'find'.
返回
Number of replaced characters.

◆  Replace() [2/3]

MAXON_METHOD Result < Int > Replace ( const REFTYPE &  find ,
const REFTYPE &  replace  
)

Replaces all occurrences of string 'find' in the current string with the given string 'replace'.

参数
[in] find Search string. Each occurrence will be replaced with 'replace'.
[in] replace Replacement of 'find'. Can be an empty string, in which case all 'find' strings will be removed.
返回
Number of replaced strings.

◆  Replace() [3/3]

MAXON_METHOD Result < Int > Replace ( CHARTYPE  find ,
const REFTYPE &  replace  
)

Replaces all occurrences of the character 'find' in the current string with the given string 'replace'.

参数
[in] find Search character. Each occurrence will be replaced with 'replace'.
[in] replace Replacement of 'find'. Can be an empty string, in which case all 'find' characters will be removed.
返回
Number of replaced strings.

◆  Find() [1/2]

MAXON_FUNCTION Bool Find ( const REFTYPE &  str ,
Int pos ,
StringPosition   start = 0  
) const

Searches for the first occurrence of 'str' within a string.

参数
[in] str The search string.
[out] pos Pointer to be filled with the position where 'str' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return false.
返回
True if 'str' has been found, in that case *pos contains the position where the first occurance was found.

◆  FindLast() [1/2]

MAXON_FUNCTION Bool FindLast ( const REFTYPE &  str ,
Int pos ,
StringPosition   start = StringEnd()  
) const

Searches for the last occurrence of 'str' within a string.

参数
[in] str The search string.
[out] pos Pointer to be filled with the position where 'str' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return false.
返回
True if 'str' has been found, in that case *pos contains the position where the last occurance was found.

◆  Find() [2/2]

MAXON_FUNCTION Bool Find ( CHARTYPE  ch ,
Int pos ,
StringPosition   start = 0  
) const

Searches for the first occurrence of character 'ch' within a string.

参数
[in] ch The search character.
[out] pos Pointer to be filled with the position where 'ch' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return false.
返回
True if 'ch' has been found, in that case *pos contains the position where the first occurance was found.

◆  FindLast() [2/2]

MAXON_FUNCTION Bool FindLast ( CHARTYPE  ch ,
Int pos ,
StringPosition   start = StringEnd()  
) const

Searches for the last occurrence of character 'ch' within a string.

参数
[in] ch The search character.
[out] pos Pointer to be filled with the position where 'ch' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return false.
返回
True if 'ch' has been found, in that case *pos contains the position where the last occurance was found.

◆  FindUpper()

MAXON_FUNCTION Bool FindUpper ( const REFTYPE &  str ,
Int pos ,
StringPosition   start = 0  
) const

Uppercase search for the first occurrence of 'str' within a string (which doesn't need to contain uppercase characters).

参数
[in] str The search string, must be completely uppercase, otherwise no matches will be found.
[out] pos Pointer to be filled with the position where 'ch' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from. If it is out of bounds the function will return false.
返回
True if 'str' has been found, in that case *pos contains the position where the first occurance was found.

◆  FindLastUpper()

MAXON_FUNCTION Bool FindLastUpper ( const REFTYPE &  str ,
Int pos ,
StringPosition   start = StringEnd()  
) const

Uppercase search for the last occurrence of 'str' within a string (which doesn't need to contain uppercase characters).

参数
[in] str The search string, must be completely uppercase, otherwise no matches will be found.
[out] pos Pointer to be filled with the position where 'ch' was found. This parameter can be a nullptr. In case no occurence was found *pos is initialized with InvalidArrayIndex.
[in] start Starting position within the current string to search from (backwards). The character at the given position will not be included in the search. If it is out of bounds the function will return false.
返回
True if 'str' has been found, in that case *pos contains the position where the last occurance was found.

◆  GetLeftPart()

MAXON_FUNCTION INTERFACETYPE* GetLeftPart ( StringPosition   start ) const

Returns the string part left of the given position. The character at position will not be included.

参数
[in] start Partitioning position.
返回
The partial string, or empty string if 'start' was out of boundaries. Will be an empty reference on failure (apply iferr for error handling).

◆  GetRightPart()

MAXON_FUNCTION INTERFACETYPE* GetRightPart ( StringPosition   start ) const

Returns the string part right of the given position. The character at position will be included.

参数
[in] start Partitioning position.
返回
The partial string, or empty string if 'start' was out of boundaries. Will be an empty reference on failure (apply iferr for error handling).

◆  StartsWith() [1/2]

MAXON_FUNCTION Bool StartsWith ( CHARTYPE  ch ) const

Checks if the string starts with a certain character.

参数
[in] ch The character to be checked.
返回
True if the string starts with the given character.

◆  StartsWith() [2/2]

MAXON_FUNCTION Bool StartsWith ( const REFTYPE &  str ) const

Checks if the current string starts with a given string.

参数
[in] str The string part.
返回
True if the string starts with the string 'str'.

◆  EndsWith() [1/2]

MAXON_FUNCTION Bool EndsWith ( CHARTYPE  ch ) const

Checks if the string ends with a certain character.

参数
[in] ch The character to be checked.
返回
True if the string end with the given character.

◆  EndsWith() [2/2]

MAXON_FUNCTION Bool EndsWith ( const REFTYPE &  str ) const

Checks if the current string end with a given string.

参数
[in] str The string part.
返回
True if the string ends with the string 'str'.

◆  Trim()

MAXON_FUNCTION Result <void> Trim ( )

Removes all characters with value <= 0x20 (e.g. space, tab, line feed) at the beginning and the end of the string.

返回
OK on success.
maxon::STRINGCOMPARISON::MEMORY
@ MEMORY
default - fast comparison, memory block is directly compared. This does not result in a correct alpha...