ADTF  3.18.2
cStringUtil

String Helper Class. More...

Public Types

typedef tUInt64 tHashKey
 Defines the Type for the Hashkey generated with GetHash.
 
typedef tUInt32 tHashKey32
 

Static Public Member Functions

static tInt Compare (const tChar *str1, const tChar *str2, tSize nPos, tSize nLength)
 This function compares two given strings using the generic-text function _tcscmp. More...
 
static tInt Compare (const tChar *str1, const tChar *str2, tSize nLength=InvalidPos)
 This function compares two given strings using the generic-text function _tcscmp. More...
 
static tInt CompareNoCase (const tChar *str1, const tChar *str2, tSize nPos, tSize nLength)
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
static tInt CompareNoCase (const tChar *str1, const tChar *str2, tSize nLength=InvalidPos)
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
static tBool IsEqual (const tChar *str1, const tChar *str2, tSize nPos, tSize nLength)
 This function checks if the two strings are equal (case sensitive) More...
 
static tBool IsEqual (const tChar *str1, const tChar *str2, tSize nLength=InvalidPos)
 This function checks if the two strings are equal (case sensitive) More...
 
static tBool IsEqualNoCase (const tChar *str1, const tChar *str2, tSize nPos, tSize nLength)
 This function checks if the two strings are equal (case insensitive) More...
 
static tBool IsEqualNoCase (const tChar *str1, const tChar *str2, tSize nLength=InvalidPos)
 This function checks if the two strings are equal (case insensitive) More...
 
static tBool IsInteger (const tChar *strToCheck, tSize nLength=InvalidPos)
 Check if string content represents an integer value. More...
 
static tBool IsFloat (const tChar *strToCheck)
 Check if string content represents a floating point value. More...
 
static tBool IsNumeric (const tChar *strToCheck)
 Check if string content represents a numeric value. More...
 
static tSize FindFirstOfToken (const tChar *strString, const tChar *strTokenList, tSize szStartPos=0, tSize nLength=InvalidPos)
 This function searches the string for the first occurrence of a token (character) that is also contained in the given token list. More...
 
static tSize RFindFirstOfToken (const tChar *strString, const tChar *strTokenList, tSize szStartPos=InvalidPos, tSize nLength=InvalidPos)
 This function searches the string for the last occurrence of a token (character) that is also contained in the given token list. More...
 
static tSize FindFirstNotOfToken (const tChar *strString, const tChar *strTokenList, tSize szStartPos=0, tSize nLength=InvalidPos)
 This function searches the string for the first occurrence of a token (character) that is not also contained in the given token list. More...
 
static tBool IsOneOf (tChar cValue, const tChar *strTokenList)
 Checks if the character is contained in the token list. More...
 
static tCharRepeat (tChar *strDest, tSize szDestSize, tSize nCount, tChar cCharacter)
 Fill a string with a repetitive character sequence. More...
 
static tCharPushFront (tChar *strDest, tSize szDestSize, const tChar *strSource, tSize nCount)
 This function adds the content of one string to the beginning of another string. More...
 
static tCharDelete (tChar *strString, tSize nPos, tSize nLength=InvalidPos)
 This function deletes characters from a string. More...
 
static tBool IsWhiteChar (tChar c)
 This function checks if a given tChar value is a whitespace character. More...
 
static tBool IsSymbolChar (tChar c)
 This function checks if a given tChar value is valid to be used in a symbol name. More...
 
static tBool IsNumber (tChar c)
 This function checks if a tChar is a number. More...
 
static const tCharFromType (tInt32 i32Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat="")
 This function creates a new cString object from a tInt32 value. More...
 
static const tCharFromType (tUInt32 ui32Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat="")
 This function creates a new cString object from a tUInt32 value. More...
 
static const tCharFromType (tInt64 i64Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat="")
 This function creates a new cString object from a tInt64 value. More...
 
static const tCharFromType (tUInt64 ui64Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat="")
 This function creates a new cString object from a tUInt64 value. More...
 
static const tCharFromType (tBool bValue, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat)
 This function creates a new cString object from a boolean value. More...
 
static const tCharFromType (tFloat32 f32Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat)
 This function creates a new cString object from a float value. More...
 
static const tCharFromType (tFloat64 f64Value, tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat)
 This function creates a new cString object from a double value. More...
 
static tResult Format (tChar *strBufferResult, tSize szBufferResult, const tChar *strFormat,...)
 Write formatted data to a string. More...
 
static tVoid ToType (const tChar *strString, tInt32 &i32Value)
 Escape control characters. More...
 
static tVoid ToType (const tChar *strString, tUInt32 &ui32Value)
 This function converts the string to an integer value. More...
 
static tVoid ToType (const tChar *strString, tInt64 &i64Value)
 This function converts the string to an integer value. More...
 
static tVoid ToType (const tChar *strString, tUInt64 &ui64Value)
 This function converts the string to an integer value. More...
 
static tVoid ToType (const tChar *strString, tFloat64 &f64Value)
 This function converts the string to a floating-point value. More...
 
static tVoid ToType (const tChar *strString, tFloat32 &f32Value)
 This function converts the string to a floating-point value. More...
 
static tVoid ToType (const tChar *strString, tBool &bBool)
 This function converts the string to a boolean value. More...
 
static tVoid HexToType (const tChar *strString, tInt64 &i64Value)
 This function converts a hexadecimal string representation to an integer value. More...
 
static tCharCopy (tChar *pstrDestination, const tChar *pstrSource, tSize nCount=InvalidPos, tSize nDestinationBufferSize=InvalidPos)
 Copies a null terminated string to another string buffer. More...
 
static tInt Scan (const tChar *strStringToScan, const tChar *sFormat,...)
 This function reads data from the input string and writes the data into the location(s) given by arguments. More...
 
static tVoid TrimFunc (tChar *strStringBuffer, tSize nBufferLength, const tBool bLeft, const tBool bRight, const tBool bNumeric)
 This function removes whitespace and redundant zero characters from a string object. More...
 
static tSize GetLength (const tChar *pcStr)
 Returns the length of the string. More...
 
static tHashKey GetHash (const tChar *strToHash)
 Creates a hash key from the string. More...
 
static tHashKey32 GetHash32 (const tChar *strToHash)
 Creates a hash key from the string. More...
 

Static Public Attributes

static const tSize InvalidPos
 used to identicate out of range, invalidpos or default length
 

Static Protected Attributes

static const tCharm_pcSafeBuffer
 Internally used character buffer.
 

Detailed Description

String Helper Class.

Definition at line 21 of file stringutil.h.

Member Function Documentation

◆ Compare() [1/2]

static tInt Compare ( const tChar str1,
const tChar str2,
tSize  nLength = InvalidPos 
)
static

This function compares two given strings using the generic-text function _tcscmp.

Parameters
[in]str1first string used for comparison.
[in]str2second string used for comparison.
[in]nLengthamount of characters to be compared. -1 means until end
Return values
0The strings are identical.
<0The first string is less than the second one.
>0The first string is greater than the second one.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Compare() [2/2]

static tInt Compare ( const tChar str1,
const tChar str2,
tSize  nPos,
tSize  nLength 
)
static

This function compares two given strings using the generic-text function _tcscmp.

The generic-text function _tcscmp, which is defined in tChar.H, maps to either strcmp, wcscmp, or _mbscmp depending on the character set that is defined at compile time. Each of these functions performs a case-sensitive comparison of the strings, and is not affected by locale.

Parameters
[in]str1first string used for comparison.
[in]str2second string used for comparison.
[in]nPoscharacter position to start the comparison at.
[in]nLengthamount of characters to be compared. -1 means until end
Return values
0The strings are identical.
<0The first string is less than the second one.
>0The first string is greater than the second one.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Referenced by string_base< storageT >::Compare(), string_base< storageT >::operator!=(), string_base< storageT >::operator<(), string_base< storageT >::operator<=(), string_base< storageT >::operator==(), string_base< storageT >::operator>(), and string_base< storageT >::operator>=().

◆ CompareNoCase() [1/2]

static tInt CompareNoCase ( const tChar str1,
const tChar str2,
tSize  nLength = InvalidPos 
)
static

This function compares a cString object with another string using the generic-text function _tcsicmp.

Parameters
str1[in] First string for comparison.
str2[in] Second string for comparison.
nLength[in] Compare only nLength characters.
Return values
0The strings are identical (ignoring case).
<0The first string is less than the second one (ignoring case).
>0The first string is greater than the second one (ignoring case).
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ CompareNoCase() [2/2]

static tInt CompareNoCase ( const tChar str1,
const tChar str2,
tSize  nPos,
tSize  nLength 
)
static

This function compares a cString object with another string using the generic-text function _tcsicmp.

The generic-text function _tcsicmp, which is defined in tChar.H, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale..

Parameters
str1[in] First string for comparison.
str2[in] Second string for comparison.
nPos[in] character position to start the comparison at.
nLength[in] Compare only nLength characters.
Return values
0The strings are identical (ignoring case).
<0The first string is less than the second one (ignoring case).
>0The first string is greater than the second one (ignoring case).
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Referenced by string_base< storageT >::CompareNoCase(), and string_base< storageT >::IsEqualNoCase().

◆ Copy()

static tChar* Copy ( tChar pstrDestination,
const tChar pstrSource,
tSize  nCount = InvalidPos,
tSize  nDestinationBufferSize = InvalidPos 
)
static

Copies a null terminated string to another string buffer.

This method ensures that the string stored in sDestination is null terminated:

  • by setting of pstrDestination[nDestinationBufferSize - 1] = '\0' if nCount > nDestinationBufferSize
  • by setting of pstrDestination[nDestinationBufferSize - 1] = '\0' if nCount is not set
  • by setting of pstrDestination[nCount] = '\0' if nCount < nDestinationBufferSize
  • by setting of pstrDestination[end] = '\0' if nCount and nDestinationBufferSize not set
Parameters
pstrDestination[out] 0-terminated Destination string.
pstrSource[in] 0-terminated Source string.
nCount[in] Number of characters to be copied from
the source string to the destination string object.
nDestinationBufferSize[in] The size of the destination string buffer, no more than this amount of bytes will be copied (including the null byte). -1 = no limit (not recommended, prone to buffer overflows).
Remarks
Make sure nDestinationBufferSize is set to at least nCount+1!
Returns
The function returns a pointer to the destination string.

Referenced by stack_string_base< TSIZE, datastoreType >::append(), stack_string_base< TSIZE, datastoreType >::assign(), and stack_string_data_handler< growinheap_out_of_range >::Resize().

◆ Delete()

static tChar* Delete ( tChar strString,
tSize  nPos,
tSize  nLength = InvalidPos 
)
static

This function deletes characters from a string.

Parameters
[out]strStringString to delete characters from.
[in]nPosFirst character position to start deleting from.
[in]nLengthNumber of characters to delete or -1 to delete all until the end of the string.
Returns
Return the rest of the string after deletion.

Referenced by stack_string_base< TSIZE, datastoreType >::erase().

◆ FindFirstNotOfToken()

static tSize FindFirstNotOfToken ( const tChar strString,
const tChar strTokenList,
tSize  szStartPos = 0,
tSize  nLength = InvalidPos 
)
static

This function searches the string for the first occurrence of a token (character) that is not also contained in the given token list.

Parameters
[in]strStringString to search the token in.
[in]strTokenListToken list to test for a nonmatching token.
[in]szStartPosThe index inside the string to begin the search with, or 0 to start from the beginning (default).
[in]nLengthNumber of characters within the string that should be searched or -1 to search all (default).
Returns
The zero-based index of the first character in this string that does not also occur in the token list; -1 if no match is found.

Referenced by stack_string_base< TSIZE, datastoreType >::find_first_not_of().

◆ FindFirstOfToken()

static tSize FindFirstOfToken ( const tChar strString,
const tChar strTokenList,
tSize  szStartPos = 0,
tSize  nLength = InvalidPos 
)
static

This function searches the string for the first occurrence of a token (character) that is also contained in the given token list.

Parameters
[in]strStringString to search the token in.
[in]strTokenListToken list to test for a matching token.
[in]szStartPosThe index inside the string to begin the search with, or 0 to start from the beginning (default).
[in]nLengthNumber of characters within the string that should be searched or -1 to search all (default).
Returns
The zero-based index of the first character in this string that also occurs in the token list; -1 if no match is found.

Referenced by stack_string_base< TSIZE, datastoreType >::find(), and stack_string_base< TSIZE, datastoreType >::find_first_of().

◆ Format()

static tResult Format ( tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat,
  ... 
)
static

Write formatted data to a string.

The Format method formats and stores a series of characters and values in a new cString buffer object. Each argument (if any) is converted and output according to the corresponding format specification in format. The format consists of ordinary characters and has the same form and function as the format argument for printf. If copying occurs between strings that overlap, the behavior is undefined.
For 64-Bit-Integer conversion use lld (Win32, Linux) or I64d (only Win32). lld maps to a long long integer whereas I64d maps to an integer with 64-bit size. The first one may not be typesafe but is portable between Windows and Linux.

Parameters
strBufferResult[out] String Buffer to store the formatted data in.
szBufferResult[in] Buffer size.
strFormat[in] Format control string.
...[in] Variable argument list.
Returns
Return NOERROR, if the formatting succeded
See also
cString::Format

◆ FromType() [1/7]

static const tChar* FromType ( tBool  bValue,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat 
)
static

This function creates a new cString object from a boolean value.

Parameters
bValue[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ FromType() [2/7]

static const tChar* FromType ( tFloat32  f32Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat 
)
static

This function creates a new cString object from a float value.

Parameters
f32Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ FromType() [3/7]

static const tChar* FromType ( tFloat64  f64Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat 
)
static

This function creates a new cString object from a double value.

Parameters
f64Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ FromType() [4/7]

static const tChar* FromType ( tInt32  i32Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat = "" 
)
static

This function creates a new cString object from a tInt32 value.

The numeric data is converted to an unformatted string.

Parameters
i32Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

Referenced by string_base< storageT >::ToStringFromType().

◆ FromType() [5/7]

static const tChar* FromType ( tInt64  i64Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat = "" 
)
static

This function creates a new cString object from a tInt64 value.

Parameters
i64Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ FromType() [6/7]

static const tChar* FromType ( tUInt32  ui32Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat = "" 
)
static

This function creates a new cString object from a tUInt32 value.

The numeric data is converted to an unformatted string.

Parameters
ui32Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ FromType() [7/7]

static const tChar* FromType ( tUInt64  ui64Value,
tChar strBufferResult,
tSize  szBufferResult,
const tChar strFormat = "" 
)
static

This function creates a new cString object from a tUInt64 value.

Parameters
ui64Value[in] Numeric value.
strBufferResult[out] String Buffer to store the converted value in.
szBufferResult[in] Buffer size.
strFormat[in] Format definition (see Format).
Returns
Returns a pointer to the converted string.

◆ GetHash()

static tHashKey GetHash ( const tChar strToHash)
static

Creates a hash key from the string.

Parameters
[in]strToHashThe string.
Returns
return the hash key.

◆ GetHash32()

static tHashKey32 GetHash32 ( const tChar strToHash)
static

Creates a hash key from the string.

Parameters
[in]strToHashThe string.
Returns
return the hash key.

◆ GetLength()

◆ HexToType()

static tVoid HexToType ( const tChar strString,
tInt64 i64Value 
)
static

This function converts a hexadecimal string representation to an integer value.

A valid hex number has the following representation [+-]? 0? x? {[0-9a-fA-F]*

Parameters
[in]strStringString that should be converted.
[out]i64ValueReference to the integer variable that should store the converted integer value or 0 (error case)
Returns
tVoid

Referenced by string_base< storageT >::HexToType().

◆ IsEqual() [1/2]

static tBool IsEqual ( const tChar str1,
const tChar str2,
tSize  nLength = InvalidPos 
)
static

This function checks if the two strings are equal (case sensitive)

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
nLength[in] Compare only nLength characters.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ IsEqual() [2/2]

static tBool IsEqual ( const tChar str1,
const tChar str2,
tSize  nPos,
tSize  nLength 
)
static

This function checks if the two strings are equal (case sensitive)

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
nPos[in] character position to start the comparison at.
nLength[in] Compare only nLength characters.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Referenced by stack_string_base< TSIZE, datastoreType >::find(), and adtf_ddl::access_element::find_index().

◆ IsEqualNoCase() [1/2]

static tBool IsEqualNoCase ( const tChar str1,
const tChar str2,
tSize  nLength = InvalidPos 
)
static

This function checks if the two strings are equal (case insensitive)

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
nLength[in] Compare only nLength characters.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ IsEqualNoCase() [2/2]

static tBool IsEqualNoCase ( const tChar str1,
const tChar str2,
tSize  nPos,
tSize  nLength 
)
static

This function checks if the two strings are equal (case insensitive)

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
nPos[in] character position to start the comparison at.
nLength[in] Compare only nLength characters.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ IsFloat()

static tBool IsFloat ( const tChar strToCheck)
static

Check if string content represents a floating point value.

Allowed float format [whitespace] [sign] [digits] [.digits] [ {d | D | e | E }[sign]digits] [whitespace] sign is either plus (+) or minus (-) digits (0123456789) The decimal digits may be followed by an exponent, which consists of an introductory letter (d, D, e, or E) and an optionally signed decimal integer.

Parameters
[in]strToCheckString representation that should be checked.
Returns
tBool tTrue if the value represents a floating point number

Referenced by string_base< storageT >::IsFloat().

◆ IsInteger()

static tBool IsInteger ( const tChar strToCheck,
tSize  nLength = InvalidPos 
)
static

Check if string content represents an integer value.

A hex number will not be identified as an integer value.

  • and - may precede the number. White spaces are not allowed. [whitespace] [sign] [digits] [whitespace] sign is either plus (+) or minus (-) digits (0123456789)
Parameters
[in]strToCheckString representation that should be checked.
[in]nLengthCheck only nLength characters. Default checks complete string.
Returns
tBool, tTrue if the value is a integer number
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Referenced by string_base< storageT >::IsInteger().

◆ IsNumber()

static tBool IsNumber ( tChar  c)
static

This function checks if a tChar is a number.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a number or false otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ IsNumeric()

static tBool IsNumeric ( const tChar strToCheck)
static

Check if string content represents a numeric value.

Parameters
[in]strToCheckString representation that should be checked.
Returns
tBool tTrue if the value represents a floating or integer number

◆ IsOneOf()

static tBool IsOneOf ( tChar  cValue,
const tChar strTokenList 
)
static

Checks if the character is contained in the token list.

Parameters
[in]cValueCharacter value to search for.
[in]strTokenListToken list to search the character in.
Returns
Returns true if the character can be found in the list or false otherwise.

Referenced by string_base< storageT >::LeftTrim(), and string_base< storageT >::NumTrim().

◆ IsSymbolChar()

static tBool IsSymbolChar ( tChar  c)
static

This function checks if a given tChar value is valid to be used in a symbol name.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a whitespace or false otherwise.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ IsWhiteChar()

static tBool IsWhiteChar ( tChar  c)
static

This function checks if a given tChar value is a whitespace character.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a whitespace or false otherwise.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Referenced by string_base< storageT >::LeftTrim(), and string_base< storageT >::RightTrim().

◆ PushFront()

static tChar* PushFront ( tChar strDest,
tSize  szDestSize,
const tChar strSource,
tSize  nCount 
)
static

This function adds the content of one string to the beginning of another string.

Parameters
[out]strDestDestination string to push the string content to.
[in]szDestSizeSize of the destination string.
[in]strSourceSource string to copy content from.
[in]nCountNumber of characters to copy from the source string or -1 to copy all.
Returns
Return the string with the added sequence at its start.

Referenced by stack_string_base< TSIZE, datastoreType >::insert().

◆ Repeat()

static tChar* Repeat ( tChar strDest,
tSize  szDestSize,
tSize  nCount,
tChar  cCharacter 
)
static

Fill a string with a repetitive character sequence.

Parameters
[out]strDestDestination string to store the character sequence in.
[in]szDestSizeSize of the destination string.
[in]nCountNumber of times the character should be repeated.
[in]cCharacterCharacter value to repeat.
Returns
Return the string with the repetitive character sequence.

Referenced by stack_string_base< TSIZE, datastoreType >::assign().

◆ RFindFirstOfToken()

static tSize RFindFirstOfToken ( const tChar strString,
const tChar strTokenList,
tSize  szStartPos = InvalidPos,
tSize  nLength = InvalidPos 
)
static

This function searches the string for the last occurrence of a token (character) that is also contained in the given token list.

The search runs backwards.

Parameters
[in]strStringString to search the token in.
[in]strTokenListToken list to test for a matching token.
[in]szStartPosThe index inside the string to begin the search with, or -1 to start from the end (default).
[in]nLengthNumber of characters within the string that should be searched or -1 to search all (default).
Returns
The zero-based index of the last character in this string that also occurs in the token list; -1 if no match is found.

Referenced by stack_string_base< TSIZE, datastoreType >::rfind().

◆ Scan()

static tInt Scan ( const tChar strStringToScan,
const tChar sFormat,
  ... 
)
static

This function reads data from the input string and writes the data into the location(s) given by arguments.

Each argument must be a pointer to a variable of a type that corresponds to a type specifier in format. If copying takes place between strings that overlap, the behavior is undefined.

Use following format types: For tInt use "%d" For tUInt use "%u" For tUInt use "%u" For tFloat / tFloat64 use "%lf" For tFloat32 "%f" For tChar String use i.e "%80s" if you want to read 80 characters.

For 64-Bit-Integer (tTimeStamp, tInt64) conversion use lld (Win32, Linux) lld maps to a long long integer. This may not be typesafe but is portable between Windows and Linux.

Parameters
strStringToScan[in] Source cString object.
sFormat[in] Format of the variables in the Source string.
...[out] variables of types for string Format values in corresponding order
Returns
The function returns the number of fields successfully converted and assigned. The return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned. The return value lower 0 for an error.
Remarks
: For Floating values this method is very imprecise!
See also
cString::Format

◆ ToType() [1/7]

static tVoid ToType ( const tChar strString,
tBool bBool 
)
static

This function converts the string to a boolean value.

Only the following strings will be interpreted as true (not case sensitive): "true","on","1", all other strings will be interpreted as false. If a string is concatenate by a true-literal (and vice versa) it is interpreted as false.

Parameters
[in]strStringString that should be converted.
[out]bBoolReference to the boolean variable that should store the converted boolean value or false (error case)
Returns
tVoid

◆ ToType() [2/7]

static tVoid ToType ( const tChar strString,
tFloat32 f32Value 
)
static

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. So hex numbers can not be interpreted! Both '.' and ',' are interpreted as decimal point.

Parameters
[in]strStringString that should be converted.
[out]f32ValueReference to the float variable that should store the converted floating point value or 0.0 (error case)
Returns
tVoid

◆ ToType() [3/7]

static tVoid ToType ( const tChar strString,
tFloat64 f64Value 
)
static

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. So hex numbers can not be interpreted! Both '.' and ',' are interpreted as decimal point.

Parameters
[in]strStringString that should be converted.
[out]f64ValueReference to the float variable that should store the converted floating point value or 0.0 (error case)
Returns
tVoid

◆ ToType() [4/7]

static tVoid ToType ( const tChar strString,
tInt32 i32Value 
)
static

Escape control characters.

Returns
New cString object containing the formatted data. Unescape control characters.
New cString object containing the formatted data. This function converts the string to an integer value. The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see
See also
HexToInt().
Parameters
[in]strStringString that should be converted.
[out]i32ValueReference to the integer variable that should store the converted integer value or 0 (error case)

Referenced by string_base< storageT >::ToType().

◆ ToType() [5/7]

static tVoid ToType ( const tChar strString,
tInt64 i64Value 
)
static

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted.
Parameters
[in]strStringString that should be converted.
[out]i64ValueReference to the integer variable that should store the converted integer value or 0 (error case)
Returns
tVoid

◆ ToType() [6/7]

static tVoid ToType ( const tChar strString,
tUInt32 ui32Value 
)
static

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted
Parameters
[in]strStringString that should be converted.
[out]ui32ValueReference to the integer variable that should store the converted integer value or 0 (error case) i.e. negative numbers
Returns
tVoid

◆ ToType() [7/7]

static tVoid ToType ( const tChar strString,
tUInt64 ui64Value 
)
static

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt().
Parameters
[in]strStringString that should be converted.
[out]ui64ValueReference to the integer variable that should store the converted integer value or 0 (error case) i.e. negative numbers
Returns
tVoid

◆ TrimFunc()

static tVoid TrimFunc ( tChar strStringBuffer,
tSize  nBufferLength,
const tBool  bLeft,
const tBool  bRight,
const tBool  bNumeric 
)
static

This function removes whitespace and redundant zero characters from a string object.

Parameters
[out]strStringBufferString buffer containing the string that should be trimmed.
[in]nBufferLengthSize of the string buffer.
[in]bLeftWhether or not to trim string on left side.
[in]bRightWhether or not to trim string on right side.
[in]bNumericWhether or not the string content is a numeric value and zero characters should be trimmed.
Returns
tVoid