Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
TCollection_ExtendedString Class Reference

A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. ExtendedString objects follow "value semantics", that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use HExtendedString objects to get handles to strings. More...

#include <TCollection_ExtendedString.hxx>

Public Member Functions

 TCollection_ExtendedString () noexcept
 Initializes an ExtendedString to an empty ExtendedString.
 
 TCollection_ExtendedString (const char *const theString, const bool theIsMultiByte=false)
 Creation by converting a CString to an extended string. If theIsMultiByte is true then the string is treated as having UTF-8 coding. If it is not a UTF-8 then theIsMultiByte is ignored and each character is copied to ExtCharacter.
 
 TCollection_ExtendedString (const char16_t *const theString)
 Creation by converting an ExtString (char16_t*) to an extended string.
 
 TCollection_ExtendedString (const wchar_t *theStringUtf)
 Initialize from wide-char string considering it as Unicode string (the size of wide char is a platform-dependent - e.g. on Windows wchar_t is UTF-16).
 
 TCollection_ExtendedString (const char theChar)
 Initializes an ExtendedString with a single ASCII character.
 
 TCollection_ExtendedString (const char16_t theChar)
 Initializes an ExtendedString with a single extended character.
 
 TCollection_ExtendedString (const int theLength, const char16_t theFiller)
 Initializes an ExtendedString with specified length space allocated and filled with filler character. This is useful for buffers.
 
 TCollection_ExtendedString (const int theValue)
 Initializes an ExtendedString with an integer value.
 
 TCollection_ExtendedString (const double theValue)
 Initializes an ExtendedString with a real value.
 
 TCollection_ExtendedString (const TCollection_ExtendedString &theString)
 Initializes an ExtendedString with another ExtendedString.
 
 TCollection_ExtendedString (TCollection_ExtendedString &&theOther) noexcept
 Move constructor.
 
 TCollection_ExtendedString (const TCollection_AsciiString &theString, const bool theIsMultiByte=true)
 Creation by converting an AsciiString to an extended string. The string is treated as having UTF-8 coding. If it is not a UTF-8 or multi byte then each character is copied to ExtCharacter.
 
 TCollection_ExtendedString (const char16_t *const theString, const int theLength)
 Initializes an ExtendedString with a char16_t string and explicit length.
 
template<std::size_t N>
 TCollection_ExtendedString (const char16_t(&theLiteral)[N])
 Template constructor for char16_t string literals or arrays. For true string literals (const char16_t[N] in code), the size is computed at runtime by scanning for null terminator to handle both literals and buffers correctly.
 
void AssignCat (const TCollection_ExtendedString &theOther)
 Appends the other extended string to this extended string. Note that this method is an alias of operator +=.
 
void operator+= (const TCollection_ExtendedString &theOther)
 
void AssignCat (const int theOther)
 Appends the integer value to this extended string.
 
void operator+= (const int theOther)
 
void AssignCat (const char theChar)
 Appends the ASCII character to this extended string.
 
void operator+= (const char theChar)
 
void AssignCat (const double theOther)
 Appends the real value to this extended string.
 
void operator+= (const double theOther)
 
void AssignCat (const char16_t theChar)
 Appends the utf16 char to this extended string.
 
void AssignCat (const char16_t *const theString, const int theLength)
 Core implementation: Appends char16_t string (pointer and length) to this extended string. This is the primary implementation that all other AssignCat overloads redirect to.
 
void AssignCat (const char16_t *const theString)
 Appends the char16_t string to this extended string.
 
void operator+= (const char16_t *const theString)
 Appends the char16_t string to this extended string (alias of AssignCat()).
 
template<std::size_t N>
void AssignCat (const char16_t(&theLiteral)[N])
 Template method for appending char16_t string literals or arrays. For char arrays (like buffers), scans for null terminator to get actual length.
 
template<std::size_t N>
void operator+= (const char16_t(&theLiteral)[N])
 
TCollection_ExtendedString Cat (const char16_t *const theOther, const int theLength) const
 Core implementation: Concatenates char16_t string (pointer and length) and returns a new string.
 
TCollection_ExtendedString Cat (const char16_t *const theOther) const
 Concatenates char16_t string and returns a new string.
 
TCollection_ExtendedString operator+ (const char16_t *const theOther) const
 
TCollection_ExtendedString Cat (const int theOther) const
 Appends the integer value to this string and returns a new string.
 
TCollection_ExtendedString operator+ (const int theOther) const
 
TCollection_ExtendedString Cat (const double theOther) const
 Appends the real value to this string and returns a new string.
 
TCollection_ExtendedString operator+ (const double theOther) const
 
TCollection_ExtendedString Cat (const char theChar) const
 Appends a single ASCII character to this string and returns a new string.
 
TCollection_ExtendedString operator+ (const char theChar) const
 
TCollection_ExtendedString Cat (const char16_t theChar) const
 Appends a single extended (char16_t) character to this string and returns a new string.
 
TCollection_ExtendedString operator+ (const char16_t theChar) const
 
TCollection_ExtendedString Cat (const TCollection_ExtendedString &theOther) const
 Appends the other extended string to this string and returns a new string.
 
TCollection_ExtendedString operator+ (const TCollection_ExtendedString &theOther) const
 
void ChangeAll (const char16_t theChar, const char16_t theNewChar)
 Substitutes all the characters equal to theChar by theNewChar in this ExtendedString. The substitution can be case sensitive. If you don't use default case sensitive, no matter whether theChar is uppercase or not.
 
void Clear ()
 Removes all characters contained in this string. This produces an empty ExtendedString.
 
void Copy (const char16_t *const theString, const int theLength)
 Core implementation: Copy from a char16_t pointer with explicit length.
 
void Copy (const char16_t *const theString)
 Copy from a char16_t pointer.
 
void Copy (const TCollection_ExtendedString &theFromWhere)
 Copy theFromWhere to this string. Used as operator =.
 
TCollection_ExtendedStringoperator= (const TCollection_ExtendedString &theOther)
 Copy assignment operator.
 
TCollection_ExtendedStringoperator= (const char16_t *const theString)
 Assignment from char16_t pointer.
 
void Move (TCollection_ExtendedString &&theOther)
 Moves string without reallocations.
 
TCollection_ExtendedStringoperator= (TCollection_ExtendedString &&theOther) noexcept
 Move assignment operator.
 
void Swap (TCollection_ExtendedString &theOther)
 Exchange the data of two strings (without reallocating memory).
 
 ~TCollection_ExtendedString ()
 Frees memory allocated by ExtendedString.
 
void Insert (const int theWhere, const char16_t theWhat)
 Insert a Character at position theWhere.
 
void Insert (const int theWhere, const char16_t *const theWhat, const int theLength)
 Core implementation: Insert a char16_t string (pointer and length) at position theWhere.
 
void Insert (const int theWhere, const char16_t *const theWhat)
 Insert a char16_t string at position theWhere.
 
void Insert (const int theWhere, const TCollection_ExtendedString &theWhat)
 Insert an ExtendedString at position theWhere.
 
bool IsEmpty () const
 Returns True if this string contains no characters.
 
bool IsEqual (const char16_t *const theOther, const int theLength) const
 Core implementation: Returns true if this string equals theOther (pointer and length).
 
bool IsEqual (const char16_t *const theOther) const
 Returns true if this string equals theOther null-terminated string. Note that this method is an alias of operator ==.
 
bool operator== (const char16_t *const theOther) const
 
bool IsEqual (const TCollection_ExtendedString &theOther) const
 Returns true if the characters in this extended string are identical to the characters in theOther extended string. Note that this method is an alias of operator ==.
 
bool operator== (const TCollection_ExtendedString &theOther) const
 
bool IsDifferent (const char16_t *const theOther, const int theLength) const
 Core implementation: Returns true if this string differs from theOther (pointer and length).
 
bool IsDifferent (const char16_t *const theOther) const
 Returns true if this string differs from theOther null-terminated string. Note that this method is an alias of operator !=.
 
bool operator!= (const char16_t *const theOther) const
 
bool IsDifferent (const TCollection_ExtendedString &theOther) const
 Returns true if there are differences between the characters in this extended string and theOther extended string. Note that this method is an alias of operator !=.
 
bool operator!= (const TCollection_ExtendedString &theOther) const
 
bool IsLess (const char16_t *const theOther, const int theLength) const
 Core implementation: Returns TRUE if this string is lexicographically less than theOther.
 
bool IsLess (const char16_t *const theOther) const
 Returns TRUE if this string is lexicographically less than theOther.
 
bool operator< (const char16_t *const theOther) const
 
bool IsLess (const TCollection_ExtendedString &theOther) const
 Returns TRUE if this string is lexicographically less than theOther.
 
bool operator< (const TCollection_ExtendedString &theOther) const
 
bool IsGreater (const char16_t *const theOther, const int theLength) const
 Core implementation: Returns TRUE if this string is lexicographically greater than theOther.
 
bool IsGreater (const char16_t *const theOther) const
 Returns TRUE if this string is lexicographically greater than theOther.
 
bool operator> (const char16_t *const theOther) const
 
bool IsGreater (const TCollection_ExtendedString &theOther) const
 Returns TRUE if this string is lexicographically greater than theOther.
 
bool operator> (const TCollection_ExtendedString &theOther) const
 
bool StartsWith (const char16_t *const theStartString, const int theLength) const
 Core implementation: Determines whether this string starts with theStartString.
 
bool StartsWith (const char16_t *const theStartString) const
 Determines whether this string starts with theStartString.
 
bool StartsWith (const TCollection_ExtendedString &theStartString) const
 Determines whether the beginning of this string instance matches the specified string.
 
bool EndsWith (const char16_t *const theEndString, const int theLength) const
 Core implementation: Determines whether this string ends with theEndString.
 
bool EndsWith (const char16_t *const theEndString) const
 Determines whether this string ends with theEndString.
 
bool EndsWith (const TCollection_ExtendedString &theEndString) const
 Determines whether the end of this string instance matches the specified string.
 
bool IsAscii () const
 Returns True if the ExtendedString contains only "Ascii Range" characters.
 
int Length () const
 Returns the number of 16-bit code units (might be greater than number of Unicode symbols if string contains surrogate pairs).
 
void Print (Standard_OStream &theStream) const
 Displays this string on a stream.
 
void RemoveAll (const char16_t theWhat)
 Removes every theWhat characters from this string.
 
void Remove (const int theWhere, const int theHowMany=1)
 Erases theHowMany characters from position theWhere, theWhere included.
 
int Search (const char16_t *const theWhat, const int theLength) const
 Core implementation: Searches for theWhat (pointer and length) from the beginning.
 
int Search (const char16_t *const theWhat) const
 Searches for theWhat null-terminated string from the beginning.
 
int Search (const TCollection_ExtendedString &theWhat) const
 Searches an ExtendedString in this string from the beginning and returns position of first item theWhat matching. It returns -1 if not found.
 
int SearchFromEnd (const char16_t *const theWhat, const int theLength) const
 Core implementation: Searches for theWhat (pointer and length) from the end.
 
int SearchFromEnd (const char16_t *const theWhat) const
 Searches for theWhat null-terminated string from the end.
 
int SearchFromEnd (const TCollection_ExtendedString &theWhat) const
 Searches an ExtendedString in this string from the end and returns position of first item theWhat matching. It returns -1 if not found.
 
void SetValue (const int theWhere, const char16_t theWhat)
 Replaces one character in the ExtendedString at position theWhere. If theWhere is less than zero or greater than the length of this string an exception is raised.
 
void SetValue (const int theWhere, const char16_t *const theWhat, const int theLength)
 Core implementation: Replaces a part of this string by char16_t string (pointer and length).
 
void SetValue (const int theWhere, const char16_t *const theWhat)
 Replaces a part of this string by a null-terminated char16_t string.
 
void SetValue (const int theWhere, const TCollection_ExtendedString &theWhat)
 Replaces a part of this string by another ExtendedString.
 
TCollection_ExtendedString SubString (const int theFromIndex, const int theToIndex) const
 Copies characters from this string starting from index theFromIndex to the index theToIndex (inclusive). Raises an exception if theToIndex or theFromIndex is out of bounds.
 
TCollection_ExtendedString Split (const int theWhere)
 Splits this extended string into two sub-strings at position theWhere.
 
TCollection_ExtendedString Token (const char16_t *const theSeparators, const int theWhichOne=1) const
 Extracts theWhichOne token from this string. By default, the theSeparators is set to space and tabulation. By default, the token extracted is the first one (theWhichOne = 1). theSeparators contains all separators you need. If no token indexed by theWhichOne is found, it returns an empty ExtendedString.
 
const char16_tToExtString () const
 Returns pointer to ExtString (char16_t*).
 
void Trunc (const int theHowMany)
 Truncates this string to theHowMany characters.
 
char16_t Value (const int theWhere) const
 Returns character at position theWhere in this string. If theWhere is less than zero or greater than the length of this string, an exception is raised.
 
size_t HashCode () const
 Returns a hashed value for the extended string. Note: if string is ASCII, the computed value is the same as the value computed with the HashCode function on a TCollection_AsciiString string composed with equivalent ASCII characters.
 
int ToUTF8CString (Standard_PCharacter &theCString) const
 Converts the internal myString to UTF8 coding and returns length of the out CString. A memory for the theCString should be allocated before call!
 
int LengthOfCString () const
 Returns expected CString length in UTF8 coding (like strlen, without null terminator). It can be used for memory calculation before converting to CString containing symbols in UTF8 coding. For external allocation, use: char* buf = new char[str.LengthOfCString() + 1];.
 
void LeftAdjust ()
 Removes all space characters in the beginning of the string.
 
void RightAdjust ()
 Removes all space characters at the end of the string.
 
void LeftJustify (const int theWidth, const char16_t theFiller)
 Left justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.
 
void RightJustify (const int theWidth, const char16_t theFiller)
 Right justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.
 
void Center (const int theWidth, const char16_t theFiller)
 Modifies this string so that its length becomes equal to theWidth and the new characters are equal to theFiller. New characters are added both at the beginning and at the end of this string. If theWidth is less than the length of this string, nothing happens.
 
void Capitalize ()
 Converts the first character into its corresponding upper-case character and the other characters into lowercase.
 
void Prepend (const char16_t *const theOther, const int theLength)
 Core implementation: Inserts char16_t string (pointer and length) at the beginning.
 
void Prepend (const char16_t *const theOther)
 Inserts a null-terminated char16_t string at the beginning.
 
void Prepend (const TCollection_ExtendedString &theOther)
 Inserts the other extended string at the beginning of this string.
 
int FirstLocationInSet (const TCollection_ExtendedString &theSet, const int theFromIndex, const int theToIndex) const
 Returns the index of the first character of this string that is present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.
 
int FirstLocationNotInSet (const TCollection_ExtendedString &theSet, const int theFromIndex, const int theToIndex) const
 Returns the index of the first character of this string that is NOT present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.
 
int IntegerValue () const
 Converts this extended string containing a numeric expression to an Integer.
 
bool IsIntegerValue () const
 Returns True if this extended string contains an integer value.
 
double RealValue () const
 Converts this extended string containing a numeric expression to a Real.
 
bool IsRealValue (bool theToCheckFull=false) const
 Returns True if this extended string starts with characters that can be interpreted as a real value.
 
bool IsSameString (const TCollection_ExtendedString &theOther, const bool theIsCaseSensitive) const
 Returns True if the strings contain same characters.
 

Static Public Member Functions

static const TCollection_ExtendedStringEmptyString () noexcept
 Returns a const reference to a single shared empty string instance. This method provides access to a static empty string to avoid creating temporary empty strings. Use this method instead of constructing empty strings when you need a const reference.
 
static bool IsEqual (const TCollection_ExtendedString &theString1, const TCollection_ExtendedString &theString2)
 Returns true if the characters in this extended string are identical to the characters in the other extended string. Note that this method is an alias of operator ==.
 

Detailed Description

A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. ExtendedString objects follow "value semantics", that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use HExtendedString objects to get handles to strings.

Beware that class can transparently store UTF-16 string with surrogate pairs (Unicode symbol represented by two 16-bit code units). However, surrogate pairs are not considered by the following methods:

Constructor & Destructor Documentation

◆ TCollection_ExtendedString() [1/14]

TCollection_ExtendedString::TCollection_ExtendedString ( )
noexcept

Initializes an ExtendedString to an empty ExtendedString.

◆ TCollection_ExtendedString() [2/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const char *const theString,
const bool theIsMultiByte = false )

Creation by converting a CString to an extended string. If theIsMultiByte is true then the string is treated as having UTF-8 coding. If it is not a UTF-8 then theIsMultiByte is ignored and each character is copied to ExtCharacter.

Parameters
[in]theStringthe C string to convert
[in]theIsMultiByteflag indicating UTF-8 coding

◆ TCollection_ExtendedString() [3/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const char16_t *const theString)

Creation by converting an ExtString (char16_t*) to an extended string.

Parameters
[in]theStringthe char16_t string to copy

◆ TCollection_ExtendedString() [4/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const wchar_t * theStringUtf)

Initialize from wide-char string considering it as Unicode string (the size of wide char is a platform-dependent - e.g. on Windows wchar_t is UTF-16).

This constructor is unavailable if application is built with deprecated msvc option "-Zc:wchar_t-", since OCCT itself is never built with this option.

Parameters
[in]theStringUtfthe wide character string to convert

◆ TCollection_ExtendedString() [5/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const char theChar)

Initializes an ExtendedString with a single ASCII character.

Parameters
[in]theCharthe ASCII character to initialize from

◆ TCollection_ExtendedString() [6/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const char16_t theChar)

Initializes an ExtendedString with a single extended character.

Parameters
[in]theCharthe extended character to initialize from

◆ TCollection_ExtendedString() [7/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const int theLength,
const char16_t theFiller )

Initializes an ExtendedString with specified length space allocated and filled with filler character. This is useful for buffers.

Parameters
[in]theLengththe length to allocate
[in]theFillerthe character to fill with

◆ TCollection_ExtendedString() [8/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const int theValue)

Initializes an ExtendedString with an integer value.

Parameters
[in]theValuethe integer value to convert to string

◆ TCollection_ExtendedString() [9/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const double theValue)

Initializes an ExtendedString with a real value.

Parameters
[in]theValuethe real value to convert to string

◆ TCollection_ExtendedString() [10/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const TCollection_ExtendedString & theString)

Initializes an ExtendedString with another ExtendedString.

Parameters
[in]theStringthe string to copy from

◆ TCollection_ExtendedString() [11/14]

TCollection_ExtendedString::TCollection_ExtendedString ( TCollection_ExtendedString && theOther)
noexcept

Move constructor.

Parameters
[in]theOtherthe string to move from

◆ TCollection_ExtendedString() [12/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const TCollection_AsciiString & theString,
const bool theIsMultiByte = true )

Creation by converting an AsciiString to an extended string. The string is treated as having UTF-8 coding. If it is not a UTF-8 or multi byte then each character is copied to ExtCharacter.

Parameters
[in]theStringthe ASCII string to convert
[in]theIsMultiByteflag indicating UTF-8 coding

◆ TCollection_ExtendedString() [13/14]

TCollection_ExtendedString::TCollection_ExtendedString ( const char16_t *const theString,
const int theLength )

Initializes an ExtendedString with a char16_t string and explicit length.

Parameters
[in]theStringthe char16_t string to initialize from
[in]theLengththe length of the string

◆ TCollection_ExtendedString() [14/14]

template<std::size_t N>
TCollection_ExtendedString::TCollection_ExtendedString ( const char16_t(&) theLiteral[N])
inline

Template constructor for char16_t string literals or arrays. For true string literals (const char16_t[N] in code), the size is computed at runtime by scanning for null terminator to handle both literals and buffers correctly.

Example:

TCollection_ExtendedString aString(u"Hello World"); // Works with string literals
char16_t buffer[100];
// ... fill buffer ...
TCollection_ExtendedString aBufferString(buffer); // Works with buffers too
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
A variable-length sequence of "extended" (UNICODE) characters (16-bit character type)....
Definition TCollection_ExtendedString.hxx:56
Parameters
[in]theLiteralthe string literal or char16_t array

◆ ~TCollection_ExtendedString()

TCollection_ExtendedString::~TCollection_ExtendedString ( )

Frees memory allocated by ExtendedString.

Member Function Documentation

◆ AssignCat() [1/8]

void TCollection_ExtendedString::AssignCat ( const char theChar)

Appends the ASCII character to this extended string.

Parameters
[in]theCharthe character to append

◆ AssignCat() [2/8]

void TCollection_ExtendedString::AssignCat ( const char16_t *const theString)
inline

Appends the char16_t string to this extended string.

Parameters
[in]theStringthe string to append

◆ AssignCat() [3/8]

void TCollection_ExtendedString::AssignCat ( const char16_t *const theString,
const int theLength )

Core implementation: Appends char16_t string (pointer and length) to this extended string. This is the primary implementation that all other AssignCat overloads redirect to.

Parameters
[in]theStringpointer to the string to append
[in]theLengthlength of the string to append

◆ AssignCat() [4/8]

void TCollection_ExtendedString::AssignCat ( const char16_t theChar)

Appends the utf16 char to this extended string.

Parameters
[in]theCharthe character to append

◆ AssignCat() [5/8]

template<std::size_t N>
void TCollection_ExtendedString::AssignCat ( const char16_t(&) theLiteral[N])
inline

Template method for appending char16_t string literals or arrays. For char arrays (like buffers), scans for null terminator to get actual length.

Example:

aString += u" World"; // Works with string literals
char16_t buffer[100];
// ... fill buffer ...
aString += buffer; // Works with buffers too
GLuint buffer
Definition OpenGl_glext.h:707
Parameters
[in]theLiteralthe string literal or char16_t array to append

◆ AssignCat() [6/8]

void TCollection_ExtendedString::AssignCat ( const double theOther)

Appends the real value to this extended string.

Parameters
[in]theOtherthe real value to append

◆ AssignCat() [7/8]

void TCollection_ExtendedString::AssignCat ( const int theOther)

Appends the integer value to this extended string.

Parameters
[in]theOtherthe integer to append

◆ AssignCat() [8/8]

void TCollection_ExtendedString::AssignCat ( const TCollection_ExtendedString & theOther)

Appends the other extended string to this extended string. Note that this method is an alias of operator +=.

Example:

// Result: aString == u"Hello World"
Parameters
[in]theOtherthe string to append

◆ Capitalize()

void TCollection_ExtendedString::Capitalize ( )

Converts the first character into its corresponding upper-case character and the other characters into lowercase.

Note
Only ASCII characters (a-z, A-Z) are affected by case conversion.

◆ Cat() [1/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const char theChar) const

Appends a single ASCII character to this string and returns a new string.

Parameters
[in]theCharthe ASCII character to append

◆ Cat() [2/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const char16_t *const theOther) const
inline

Concatenates char16_t string and returns a new string.

Parameters
[in]theOtherthe null-terminated string to append
Returns
new string with theOther appended

◆ Cat() [3/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const char16_t *const theOther,
const int theLength ) const

Core implementation: Concatenates char16_t string (pointer and length) and returns a new string.

Parameters
[in]theOtherpointer to the string to append
[in]theLengthlength of the string to append
Returns
new string with theOther appended

◆ Cat() [4/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const char16_t theChar) const

Appends a single extended (char16_t) character to this string and returns a new string.

Parameters
[in]theCharthe extended character to append

◆ Cat() [5/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const double theOther) const

Appends the real value to this string and returns a new string.

Parameters
[in]theOtherthe real value to append
Returns
new string with real value appended

◆ Cat() [6/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const int theOther) const

Appends the integer value to this string and returns a new string.

Parameters
[in]theOtherthe integer to append
Returns
new string with integer appended

◆ Cat() [7/7]

TCollection_ExtendedString TCollection_ExtendedString::Cat ( const TCollection_ExtendedString & theOther) const
inline

Appends the other extended string to this string and returns a new string.

Example:

Parameters
[in]theOtherthe string to append
Returns
new string with theOther appended

◆ Center()

void TCollection_ExtendedString::Center ( const int theWidth,
const char16_t theFiller )

Modifies this string so that its length becomes equal to theWidth and the new characters are equal to theFiller. New characters are added both at the beginning and at the end of this string. If theWidth is less than the length of this string, nothing happens.

Parameters
[in]theWidththe desired width of the string
[in]theFillerthe character to fill with

◆ ChangeAll()

void TCollection_ExtendedString::ChangeAll ( const char16_t theChar,
const char16_t theNewChar )

Substitutes all the characters equal to theChar by theNewChar in this ExtendedString. The substitution can be case sensitive. If you don't use default case sensitive, no matter whether theChar is uppercase or not.

Example:

aString.ChangeAll(u'H', u'M');
// Result: aString == u"Mistake"
Parameters
[in]theCharthe character to replace
[in]theNewCharthe replacement character

◆ Clear()

void TCollection_ExtendedString::Clear ( )

Removes all characters contained in this string. This produces an empty ExtendedString.

◆ Copy() [1/3]

void TCollection_ExtendedString::Copy ( const char16_t *const theString)
inline

Copy from a char16_t pointer.

Parameters
[in]theStringthe null-terminated string to copy

◆ Copy() [2/3]

void TCollection_ExtendedString::Copy ( const char16_t *const theString,
const int theLength )

Core implementation: Copy from a char16_t pointer with explicit length.

Parameters
[in]theStringpointer to the string to copy
[in]theLengthlength of the string to copy

◆ Copy() [3/3]

void TCollection_ExtendedString::Copy ( const TCollection_ExtendedString & theFromWhere)
inline

Copy theFromWhere to this string. Used as operator =.

Example:

aString = anotherString; // operator=
// Result: aString == u"Hello World"
Parameters
[in]theFromWherethe string to copy from

◆ EmptyString()

static const TCollection_ExtendedString & TCollection_ExtendedString::EmptyString ( )
staticnoexcept

Returns a const reference to a single shared empty string instance. This method provides access to a static empty string to avoid creating temporary empty strings. Use this method instead of constructing empty strings when you need a const reference.

Example:

// Use anEmptyStr instead of TCollection_ExtendedString()
static const TCollection_ExtendedString & EmptyString() noexcept
Returns a const reference to a single shared empty string instance. This method provides access to a ...
Returns
const reference to static empty string

◆ EndsWith() [1/3]

bool TCollection_ExtendedString::EndsWith ( const char16_t *const theEndString) const
inline

Determines whether this string ends with theEndString.

Parameters
[in]theEndStringthe null-terminated string to check for
Returns
true if this string ends with theEndString

◆ EndsWith() [2/3]

bool TCollection_ExtendedString::EndsWith ( const char16_t *const theEndString,
const int theLength ) const

Core implementation: Determines whether this string ends with theEndString.

Parameters
[in]theEndStringpointer to the string to check for
[in]theLengthlength of the string to check for
Returns
true if this string ends with theEndString

◆ EndsWith() [3/3]

bool TCollection_ExtendedString::EndsWith ( const TCollection_ExtendedString & theEndString) const
inline

Determines whether the end of this string instance matches the specified string.

Parameters
[in]theEndStringthe string to check for at the end
Returns
true if this string ends with theEndString

◆ FirstLocationInSet()

int TCollection_ExtendedString::FirstLocationInSet ( const TCollection_ExtendedString & theSet,
const int theFromIndex,
const int theToIndex ) const

Returns the index of the first character of this string that is present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.

Parameters
[in]theSetthe set of characters to search for
[in]theFromIndexthe starting index for search (1-based)
[in]theToIndexthe ending index for search (1-based)
Returns
the index of first character found in set, or 0 if not found

◆ FirstLocationNotInSet()

int TCollection_ExtendedString::FirstLocationNotInSet ( const TCollection_ExtendedString & theSet,
const int theFromIndex,
const int theToIndex ) const

Returns the index of the first character of this string that is NOT present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.

Parameters
[in]theSetthe set of characters to check against
[in]theFromIndexthe starting index for search (1-based)
[in]theToIndexthe ending index for search (1-based)
Returns
the index of first character not in set, or 0 if not found

◆ HashCode()

size_t TCollection_ExtendedString::HashCode ( ) const
inline

Returns a hashed value for the extended string. Note: if string is ASCII, the computed value is the same as the value computed with the HashCode function on a TCollection_AsciiString string composed with equivalent ASCII characters.

Returns
a computed hash code

◆ Insert() [1/4]

void TCollection_ExtendedString::Insert ( const int theWhere,
const char16_t *const theWhat )
inline

Insert a char16_t string at position theWhere.

Parameters
[in]theWherethe position to insert at (1-based)
[in]theWhatthe null-terminated string to insert

◆ Insert() [2/4]

void TCollection_ExtendedString::Insert ( const int theWhere,
const char16_t *const theWhat,
const int theLength )

Core implementation: Insert a char16_t string (pointer and length) at position theWhere.

Parameters
[in]theWherethe position to insert at (1-based)
[in]theWhatpointer to the string to insert
[in]theLengthlength of the string to insert

◆ Insert() [3/4]

void TCollection_ExtendedString::Insert ( const int theWhere,
const char16_t theWhat )

Insert a Character at position theWhere.

Example:

aString.Insert(1, u'W');
// Result: aString == u"Why not ?"
Parameters
[in]theWherethe position to insert at (1-based)
[in]theWhatthe character to insert

◆ Insert() [4/4]

void TCollection_ExtendedString::Insert ( const int theWhere,
const TCollection_ExtendedString & theWhat )
inline

Insert an ExtendedString at position theWhere.

Parameters
[in]theWherethe position to insert at (1-based)
[in]theWhatthe string to insert

◆ IntegerValue()

int TCollection_ExtendedString::IntegerValue ( ) const

Converts this extended string containing a numeric expression to an Integer.

Returns
the integer value

◆ IsAscii()

bool TCollection_ExtendedString::IsAscii ( ) const

Returns True if the ExtendedString contains only "Ascii Range" characters.

Returns
true if string contains only ASCII characters

◆ IsDifferent() [1/3]

bool TCollection_ExtendedString::IsDifferent ( const char16_t *const theOther) const
inline

Returns true if this string differs from theOther null-terminated string. Note that this method is an alias of operator !=.

Parameters
[in]theOtherthe char16_t string to compare with
Returns
true if strings are different, false otherwise

◆ IsDifferent() [2/3]

bool TCollection_ExtendedString::IsDifferent ( const char16_t *const theOther,
const int theLength ) const

Core implementation: Returns true if this string differs from theOther (pointer and length).

Parameters
[in]theOtherpointer to the string to compare with
[in]theLengthlength of the string to compare with
Returns
true if strings are different, false otherwise

◆ IsDifferent() [3/3]

bool TCollection_ExtendedString::IsDifferent ( const TCollection_ExtendedString & theOther) const
inline

Returns true if there are differences between the characters in this extended string and theOther extended string. Note that this method is an alias of operator !=.

Parameters
[in]theOtherthe extended string to compare with
Returns
true if strings are different, false otherwise

◆ IsEmpty()

bool TCollection_ExtendedString::IsEmpty ( ) const
inline

Returns True if this string contains no characters.

◆ IsEqual() [1/4]

bool TCollection_ExtendedString::IsEqual ( const char16_t *const theOther) const
inline

Returns true if this string equals theOther null-terminated string. Note that this method is an alias of operator ==.

Parameters
[in]theOtherthe char16_t string to compare with
Returns
true if strings are equal, false otherwise

◆ IsEqual() [2/4]

bool TCollection_ExtendedString::IsEqual ( const char16_t *const theOther,
const int theLength ) const

Core implementation: Returns true if this string equals theOther (pointer and length).

Parameters
[in]theOtherpointer to the string to compare with
[in]theLengthlength of the string to compare with
Returns
true if strings are equal, false otherwise

◆ IsEqual() [3/4]

bool TCollection_ExtendedString::IsEqual ( const TCollection_ExtendedString & theOther) const
inline

Returns true if the characters in this extended string are identical to the characters in theOther extended string. Note that this method is an alias of operator ==.

Parameters
[in]theOtherthe extended string to compare with
Returns
true if strings are equal, false otherwise

◆ IsEqual() [4/4]

static bool TCollection_ExtendedString::IsEqual ( const TCollection_ExtendedString & theString1,
const TCollection_ExtendedString & theString2 )
inlinestatic

Returns true if the characters in this extended string are identical to the characters in the other extended string. Note that this method is an alias of operator ==.

Parameters
[in]theString1first string to compare
[in]theString2second string to compare
Returns
true if strings are equal

◆ IsGreater() [1/3]

bool TCollection_ExtendedString::IsGreater ( const char16_t *const theOther) const
inline

Returns TRUE if this string is lexicographically greater than theOther.

Parameters
[in]theOtherthe char16_t string to compare with
Returns
true if this string is greater than theOther

◆ IsGreater() [2/3]

bool TCollection_ExtendedString::IsGreater ( const char16_t *const theOther,
const int theLength ) const

Core implementation: Returns TRUE if this string is lexicographically greater than theOther.

Parameters
[in]theOtherpointer to the string to compare with
[in]theLengthlength of the string to compare with
Returns
true if this string is greater than theOther

◆ IsGreater() [3/3]

bool TCollection_ExtendedString::IsGreater ( const TCollection_ExtendedString & theOther) const
inline

Returns TRUE if this string is lexicographically greater than theOther.

Parameters
[in]theOtherthe extended string to compare with
Returns
true if this string is greater than theOther

◆ IsIntegerValue()

bool TCollection_ExtendedString::IsIntegerValue ( ) const

Returns True if this extended string contains an integer value.

Returns
true if string represents an integer value

◆ IsLess() [1/3]

bool TCollection_ExtendedString::IsLess ( const char16_t *const theOther) const
inline

Returns TRUE if this string is lexicographically less than theOther.

Parameters
[in]theOtherthe char16_t string to compare with
Returns
true if this string is less than theOther

◆ IsLess() [2/3]

bool TCollection_ExtendedString::IsLess ( const char16_t *const theOther,
const int theLength ) const

Core implementation: Returns TRUE if this string is lexicographically less than theOther.

Parameters
[in]theOtherpointer to the string to compare with
[in]theLengthlength of the string to compare with
Returns
true if this string is less than theOther

◆ IsLess() [3/3]

bool TCollection_ExtendedString::IsLess ( const TCollection_ExtendedString & theOther) const
inline

Returns TRUE if this string is lexicographically less than theOther.

Parameters
[in]theOtherthe extended string to compare with
Returns
true if this string is less than theOther

◆ IsRealValue()

bool TCollection_ExtendedString::IsRealValue ( bool theToCheckFull = false) const

Returns True if this extended string starts with characters that can be interpreted as a real value.

Parameters
[in]theToCheckFullwhen TRUE, checks if entire string defines a real value; otherwise checks if string starts with a real value
Returns
true if string represents a real value

◆ IsSameString()

bool TCollection_ExtendedString::IsSameString ( const TCollection_ExtendedString & theOther,
const bool theIsCaseSensitive ) const

Returns True if the strings contain same characters.

Parameters
[in]theOtherthe string to compare with
[in]theIsCaseSensitiveflag indicating case sensitivity
Note
When case-insensitive, only ASCII characters (a-z, A-Z) are affected.
Returns
true if strings contain same characters

◆ LeftAdjust()

void TCollection_ExtendedString::LeftAdjust ( )

Removes all space characters in the beginning of the string.

◆ LeftJustify()

void TCollection_ExtendedString::LeftJustify ( const int theWidth,
const char16_t theFiller )

Left justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.

Parameters
[in]theWidththe desired width of the string
[in]theFillerthe character to fill with

◆ Length()

int TCollection_ExtendedString::Length ( ) const

Returns the number of 16-bit code units (might be greater than number of Unicode symbols if string contains surrogate pairs).

Returns
the number of 16-bit code units

◆ LengthOfCString()

int TCollection_ExtendedString::LengthOfCString ( ) const

Returns expected CString length in UTF8 coding (like strlen, without null terminator). It can be used for memory calculation before converting to CString containing symbols in UTF8 coding. For external allocation, use: char* buf = new char[str.LengthOfCString() + 1];.

Returns
expected UTF-8 string length

◆ Move()

void TCollection_ExtendedString::Move ( TCollection_ExtendedString && theOther)

Moves string without reallocations.

Parameters
[in]theOtherthe string to move from

◆ operator!=() [1/2]

bool TCollection_ExtendedString::operator!= ( const char16_t *const theOther) const
inline

◆ operator!=() [2/2]

bool TCollection_ExtendedString::operator!= ( const TCollection_ExtendedString & theOther) const
inline

◆ operator+() [1/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const char theChar) const
inline

◆ operator+() [2/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const char16_t *const theOther) const
inline

◆ operator+() [3/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const char16_t theChar) const
inline

◆ operator+() [4/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const double theOther) const
inline

◆ operator+() [5/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const int theOther) const
inline

◆ operator+() [6/6]

TCollection_ExtendedString TCollection_ExtendedString::operator+ ( const TCollection_ExtendedString & theOther) const
inline

◆ operator+=() [1/6]

void TCollection_ExtendedString::operator+= ( const char theChar)
inline

◆ operator+=() [2/6]

void TCollection_ExtendedString::operator+= ( const char16_t *const theString)
inline

Appends the char16_t string to this extended string (alias of AssignCat()).

◆ operator+=() [3/6]

template<std::size_t N>
void TCollection_ExtendedString::operator+= ( const char16_t(&) theLiteral[N])
inline

◆ operator+=() [4/6]

void TCollection_ExtendedString::operator+= ( const double theOther)
inline

◆ operator+=() [5/6]

void TCollection_ExtendedString::operator+= ( const int theOther)
inline

◆ operator+=() [6/6]

void TCollection_ExtendedString::operator+= ( const TCollection_ExtendedString & theOther)
inline

◆ operator<() [1/2]

bool TCollection_ExtendedString::operator< ( const char16_t *const theOther) const
inline

◆ operator<() [2/2]

bool TCollection_ExtendedString::operator< ( const TCollection_ExtendedString & theOther) const
inline

◆ operator=() [1/3]

TCollection_ExtendedString & TCollection_ExtendedString::operator= ( const char16_t *const theString)
inline

Assignment from char16_t pointer.

◆ operator=() [2/3]

TCollection_ExtendedString & TCollection_ExtendedString::operator= ( const TCollection_ExtendedString & theOther)
inline

Copy assignment operator.

◆ operator=() [3/3]

TCollection_ExtendedString & TCollection_ExtendedString::operator= ( TCollection_ExtendedString && theOther)
inlinenoexcept

Move assignment operator.

◆ operator==() [1/2]

bool TCollection_ExtendedString::operator== ( const char16_t *const theOther) const
inline

◆ operator==() [2/2]

bool TCollection_ExtendedString::operator== ( const TCollection_ExtendedString & theOther) const
inline

◆ operator>() [1/2]

bool TCollection_ExtendedString::operator> ( const char16_t *const theOther) const
inline

◆ operator>() [2/2]

bool TCollection_ExtendedString::operator> ( const TCollection_ExtendedString & theOther) const
inline

◆ Prepend() [1/3]

void TCollection_ExtendedString::Prepend ( const char16_t *const theOther)
inline

Inserts a null-terminated char16_t string at the beginning.

Parameters
[in]theOtherthe null-terminated string to prepend

◆ Prepend() [2/3]

void TCollection_ExtendedString::Prepend ( const char16_t *const theOther,
const int theLength )

Core implementation: Inserts char16_t string (pointer and length) at the beginning.

Parameters
[in]theOtherpointer to the string to prepend
[in]theLengthlength of the string to prepend

◆ Prepend() [3/3]

void TCollection_ExtendedString::Prepend ( const TCollection_ExtendedString & theOther)
inline

Inserts the other extended string at the beginning of this string.

Parameters
[in]theOtherthe string to prepend

◆ Print()

void TCollection_ExtendedString::Print ( Standard_OStream & theStream) const

Displays this string on a stream.

Parameters
[in]theStreamthe output stream

◆ RealValue()

double TCollection_ExtendedString::RealValue ( ) const

Converts this extended string containing a numeric expression to a Real.

Returns
the real value

◆ Remove()

void TCollection_ExtendedString::Remove ( const int theWhere,
const int theHowMany = 1 )

Erases theHowMany characters from position theWhere, theWhere included.

Example:

aString.Remove(2, 2); // erases 2 characters from position 2
// Result: aString == u"Hlo"
Parameters
[in]theWherethe position to start erasing from (1-based)
[in]theHowManythe number of characters to erase

◆ RemoveAll()

void TCollection_ExtendedString::RemoveAll ( const char16_t theWhat)

Removes every theWhat characters from this string.

Parameters
[in]theWhatthe character to remove

◆ RightAdjust()

void TCollection_ExtendedString::RightAdjust ( )

Removes all space characters at the end of the string.

◆ RightJustify()

void TCollection_ExtendedString::RightJustify ( const int theWidth,
const char16_t theFiller )

Right justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.

Parameters
[in]theWidththe desired width of the string
[in]theFillerthe character to fill with

◆ Search() [1/3]

int TCollection_ExtendedString::Search ( const char16_t *const theWhat) const
inline

Searches for theWhat null-terminated string from the beginning.

Parameters
[in]theWhatthe null-terminated string to search for
Returns
the position of first match (1-based), or -1 if not found

◆ Search() [2/3]

int TCollection_ExtendedString::Search ( const char16_t *const theWhat,
const int theLength ) const

Core implementation: Searches for theWhat (pointer and length) from the beginning.

Parameters
[in]theWhatpointer to the string to search for
[in]theLengthlength of the string to search for
Returns
the position of first match (1-based), or -1 if not found

◆ Search() [3/3]

int TCollection_ExtendedString::Search ( const TCollection_ExtendedString & theWhat) const
inline

Searches an ExtendedString in this string from the beginning and returns position of first item theWhat matching. It returns -1 if not found.

Parameters
[in]theWhatthe string to search for
Returns
the position of first match (1-based), or -1 if not found

◆ SearchFromEnd() [1/3]

int TCollection_ExtendedString::SearchFromEnd ( const char16_t *const theWhat) const
inline

Searches for theWhat null-terminated string from the end.

Parameters
[in]theWhatthe null-terminated string to search for
Returns
the position of first match from end (1-based), or -1 if not found

◆ SearchFromEnd() [2/3]

int TCollection_ExtendedString::SearchFromEnd ( const char16_t *const theWhat,
const int theLength ) const

Core implementation: Searches for theWhat (pointer and length) from the end.

Parameters
[in]theWhatpointer to the string to search for
[in]theLengthlength of the string to search for
Returns
the position of first match from end (1-based), or -1 if not found

◆ SearchFromEnd() [3/3]

int TCollection_ExtendedString::SearchFromEnd ( const TCollection_ExtendedString & theWhat) const
inline

Searches an ExtendedString in this string from the end and returns position of first item theWhat matching. It returns -1 if not found.

Parameters
[in]theWhatthe string to search for
Returns
the position of first match from end (1-based), or -1 if not found

◆ SetValue() [1/4]

void TCollection_ExtendedString::SetValue ( const int theWhere,
const char16_t *const theWhat )
inline

Replaces a part of this string by a null-terminated char16_t string.

Parameters
[in]theWherethe position to start replacement (1-based)
[in]theWhatthe null-terminated string to replace with

◆ SetValue() [2/4]

void TCollection_ExtendedString::SetValue ( const int theWhere,
const char16_t *const theWhat,
const int theLength )

Core implementation: Replaces a part of this string by char16_t string (pointer and length).

Parameters
[in]theWherethe position to start replacement (1-based)
[in]theWhatpointer to the string to replace with
[in]theLengthlength of the string to replace with

◆ SetValue() [3/4]

void TCollection_ExtendedString::SetValue ( const int theWhere,
const char16_t theWhat )

Replaces one character in the ExtendedString at position theWhere. If theWhere is less than zero or greater than the length of this string an exception is raised.

Example:

aString.SetValue(6, u'g');
// Result: aString == u"Garbage"
Parameters
[in]theWherethe position to replace at (1-based)
[in]theWhatthe character to replace with

◆ SetValue() [4/4]

void TCollection_ExtendedString::SetValue ( const int theWhere,
const TCollection_ExtendedString & theWhat )
inline

Replaces a part of this string by another ExtendedString.

Parameters
[in]theWherethe position to start replacement (1-based)
[in]theWhatthe string to replace with

◆ Split()

TCollection_ExtendedString TCollection_ExtendedString::Split ( const int theWhere)

Splits this extended string into two sub-strings at position theWhere.

  • The second sub-string (from position theWhere + 1 of this string to the end) is returned in a new extended string.
  • This extended string is modified: its last characters are removed, it becomes equal to the first sub-string (from the first character to position theWhere).

Example:

// Result: aString == u"abc" and aSecondPart == u"defg"
Parameters
[in]theWherethe position to split at (0-based)
Returns
the second part of the split string

◆ StartsWith() [1/3]

bool TCollection_ExtendedString::StartsWith ( const char16_t *const theStartString) const
inline

Determines whether this string starts with theStartString.

Parameters
[in]theStartStringthe null-terminated string to check for
Returns
true if this string starts with theStartString

◆ StartsWith() [2/3]

bool TCollection_ExtendedString::StartsWith ( const char16_t *const theStartString,
const int theLength ) const

Core implementation: Determines whether this string starts with theStartString.

Parameters
[in]theStartStringpointer to the string to check for
[in]theLengthlength of the string to check for
Returns
true if this string starts with theStartString

◆ StartsWith() [3/3]

bool TCollection_ExtendedString::StartsWith ( const TCollection_ExtendedString & theStartString) const
inline

Determines whether the beginning of this string instance matches the specified string.

Parameters
[in]theStartStringthe string to check for at the beginning
Returns
true if this string starts with theStartString

◆ SubString()

TCollection_ExtendedString TCollection_ExtendedString::SubString ( const int theFromIndex,
const int theToIndex ) const

Copies characters from this string starting from index theFromIndex to the index theToIndex (inclusive). Raises an exception if theToIndex or theFromIndex is out of bounds.

Example:

// Result: aSubString == u"cdef"
Parameters
[in]theFromIndexthe starting index (1-based)
[in]theToIndexthe ending index (1-based, inclusive)
Returns
the substring from theFromIndex to theToIndex

◆ Swap()

void TCollection_ExtendedString::Swap ( TCollection_ExtendedString & theOther)

Exchange the data of two strings (without reallocating memory).

Parameters
[in,out]theOtherthe string to exchange data with

◆ ToExtString()

const char16_t * TCollection_ExtendedString::ToExtString ( ) const

Returns pointer to ExtString (char16_t*).

Returns
the char16_t string representation

◆ Token()

TCollection_ExtendedString TCollection_ExtendedString::Token ( const char16_t *const theSeparators,
const int theWhichOne = 1 ) const

Extracts theWhichOne token from this string. By default, the theSeparators is set to space and tabulation. By default, the token extracted is the first one (theWhichOne = 1). theSeparators contains all separators you need. If no token indexed by theWhichOne is found, it returns an empty ExtendedString.

Example:

TCollection_ExtendedString aString(u"This is a message");
// Result: aToken1 == u"This"
// Result: aToken2 == u"message"
// Result: aToken3 == u"is"
// Result: aToken4 == u""
TCollection_ExtendedString bString(u"1234; test:message , value");
// Result: bToken1 == u"value"
Parameters
[in]theSeparatorsthe separator characters
[in]theWhichOnethe token number to extract (1-based)
Returns
the extracted token

◆ ToUTF8CString()

int TCollection_ExtendedString::ToUTF8CString ( Standard_PCharacter & theCString) const

Converts the internal myString to UTF8 coding and returns length of the out CString. A memory for the theCString should be allocated before call!

Parameters
[in,out]theCStringpointer to the output buffer
Returns
length of the UTF-8 string

◆ Trunc()

void TCollection_ExtendedString::Trunc ( const int theHowMany)

Truncates this string to theHowMany characters.

Example:

aString.Trunc(3);
// Result: aString == u"Hel"
Parameters
[in]theHowManythe number of characters to keep

◆ Value()

char16_t TCollection_ExtendedString::Value ( const int theWhere) const

Returns character at position theWhere in this string. If theWhere is less than zero or greater than the length of this string, an exception is raised.

Example:

char16_t aChar = aString.Value(2);
// Result: aChar == u'e'
Parameters
[in]theWherethe position to get character from (1-based)
Returns
the character at the specified position

The documentation for this class was generated from the following file: