![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
A variable-length sequence of ASCII characters (normal 8-bit character type). It provides editing operations with built-in memory management to make HAsciiString objects easier to use than ordinary character arrays. HAsciiString objects are handles to strings. More...
#include <TCollection_HAsciiString.hxx>

Public Member Functions | |
| TCollection_HAsciiString () | |
| Initializes a HAsciiString to an empty AsciiString. | |
| TCollection_HAsciiString (const char *const message) | |
| Initializes a HAsciiString with a CString. | |
| TCollection_HAsciiString (const char aChar) | |
| Initializes a HAsciiString with a single character. | |
| TCollection_HAsciiString (const int length, const char filler) | |
| Initializes a HAsciiString with <length> space allocated. and filled with <filler>.This is useful for buffers. | |
| TCollection_HAsciiString (const int value) | |
| Initializes a HAsciiString with an integer value. | |
| TCollection_HAsciiString (const double value) | |
| Initializes a HAsciiString with a real value. | |
| TCollection_HAsciiString (const TCollection_AsciiString &aString) | |
| Initializes a HAsciiString with a AsciiString. | |
| TCollection_HAsciiString (TCollection_AsciiString &&theString) noexcept | |
| Initializes a HAsciiString with a AsciiString. | |
| TCollection_HAsciiString (const occ::handle< TCollection_HAsciiString > &aString) | |
| Initializes a HAsciiString with a HAsciiString. | |
| TCollection_HAsciiString (const occ::handle< TCollection_HExtendedString > &aString, const char replaceNonAscii) | |
| Initializes a HAsciiString with a HExtendedString. If replaceNonAscii is non-null character, it will be used in place of any non-ascii character found in the source string. Otherwise, creates UTF-8 unicode string. | |
| void | AssignCat (const char *const other) |
| Appends <other> to me. | |
| void | AssignCat (const occ::handle< TCollection_HAsciiString > &other) |
| Appends <other> to me. Example: aString = aString + anotherString. | |
| void | Capitalize () |
| Converts the first character into its corresponding upper-case character and the other characters into lowercase. Example: before me = "hellO " after me = "Hello ". | |
| occ::handle< TCollection_HAsciiString > | Cat (const char *const other) const |
| Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString aString = aString + "Dummy" aString contains "I say " aString = aString + "Hello " + "Dolly" gives "I say Hello Dolly" Warning: To catenate more than one CString, you must put a String before. So the following example is WRONG ! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED This rule is applicable to AssignCat (operator +=) too. | |
| occ::handle< TCollection_HAsciiString > | Cat (const occ::handle< TCollection_HAsciiString > &other) const |
| Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString. | |
| void | Center (const int Width, const char Filler) |
| Modifies this ASCII string so that its length becomes equal to Width and the new characters are equal to Filler. New characters are added both at the beginning and at the end of this string. If Width is less than the length of this ASCII string, nothing happens. Example occ::handle<TCollection_HAsciiString> myAlphabet = new TCollection_HAsciiString ("abcdef"); myAlphabet->Center(9,' '); assert ( !strcmp( myAlphabet->ToCString(), " abcdef ") );. | |
| void | ChangeAll (const char aChar, const char NewChar, const bool CaseSensitive=true) |
| Replaces all characters equal to aChar by NewChar in this ASCII string. The substitution is case sensitive if CaseSensitive is true (default value). If you do not use the default case sensitive option, it does not matter whether aChar is upper-case or not. Example occ::handle<TCollection_HAsciiString> myMistake = new TCollection_HAsciiString ("Hather"); myMistake->ChangeAll('H','F'); assert ( !strcmp( myMistake->ToCString(), "Father") );. | |
| void | Clear () |
| Removes all characters contained in <me>. This produces an empty HAsciiString. | |
| int | FirstLocationInSet (const occ::handle< TCollection_HAsciiString > &Set, const int FromIndex, const int ToIndex) const |
| Returns the index of the first character of <me> that is present in <Set>. The search begins to the index FromIndex and ends to the the index ToIndex. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range Example: before me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 after me = "aabAcAa" returns 1. | |
| int | FirstLocationNotInSet (const occ::handle< TCollection_HAsciiString > &Set, const int FromIndex, const int ToIndex) const |
| Returns the index of the first character of <me> that is not present in the set <Set>. The search begins to the index FromIndex and ends to the the index ToIndex in <me>. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range. Example: before me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 after me = "aabAcAa" returns 3. | |
| void | Insert (const int where, const char what) |
| Insert a Character at position <where>. Example: aString contains "hy not ?" aString.Insert(1,'W'); gives "Why not ?" aString contains "Wh" aString.Insert(3,'y'); gives "Why" aString contains "Way" aString.Insert(2,'h'); gives "Why". | |
| void | Insert (const int where, const char *const what) |
| Insert a HAsciiString at position <where>. | |
| void | Insert (const int where, const occ::handle< TCollection_HAsciiString > &what) |
| Insert a HAsciiString at position <where>. | |
| void | InsertAfter (const int Index, const occ::handle< TCollection_HAsciiString > &other) |
| Inserts the other ASCII string a after a specific index in the string <me> Example: before me = "cde" , Index = 0 , other = "ab" after me = "abcde" , other = "ab". | |
| void | InsertBefore (const int Index, const occ::handle< TCollection_HAsciiString > &other) |
| Inserts the other ASCII string a before a specific index in the string <me> Raises an exception if Index is out of bounds Example: before me = "cde" , Index = 1 , other = "ab" after me = "abcde" , other = "ab". | |
| bool | IsEmpty () const |
| Returns True if the string <me> contains zero character. | |
| bool | IsLess (const occ::handle< TCollection_HAsciiString > &other) const |
| Returns TRUE if <me> is 'ASCII' less than <other>. | |
| bool | IsGreater (const occ::handle< TCollection_HAsciiString > &other) const |
| Returns TRUE if <me> is 'ASCII' greater than <other>. | |
| int | IntegerValue () const |
| Converts a HAsciiString containing a numeric expression to an Integer. Example: "215" returns 215. | |
| bool | IsIntegerValue () const |
| Returns True if the string contains an integer value. | |
| bool | IsRealValue () const |
| Returns True if the string contains a real value. | |
| bool | IsAscii () const |
| Returns True if the string contains only ASCII characters between ' ' and '~'. This means no control character and no extended ASCII code. | |
| bool | IsDifferent (const occ::handle< TCollection_HAsciiString > &S) const |
| Returns True if the string S not contains same characters than the string <me>. | |
| bool | IsSameString (const occ::handle< TCollection_HAsciiString > &S) const |
| Returns True if the string S contains same characters than the string <me>. | |
| bool | IsSameString (const occ::handle< TCollection_HAsciiString > &S, const bool CaseSensitive) const |
| Returns True if the string S contains same characters than the string <me>. | |
| void | LeftAdjust () |
| Removes all space characters in the beginning of the string. | |
| void | LeftJustify (const int Width, const char Filler) |
| Left justify. Length becomes equal to Width and the new characters are equal to Filler if Width < Length nothing happens Raises an exception if Width is less than zero Example: before me = "abcdef" , Width = 9 , Filler = ' ' after me = "abcdef ". | |
| int | Length () const |
| Returns number of characters in <me>. This is the same functionality as 'strlen' in C. | |
| int | Location (const occ::handle< TCollection_HAsciiString > &other, const int FromIndex, const int ToIndex) const |
| returns an index in the string <me> of the first occurrence of the string S in the string <me> from the starting index FromIndex to the ending index ToIndex returns zero if failure Raises an exception if FromIndex or ToIndex is out of range. Example: before me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7 after me = "aabAaAa" returns 4 | |
| int | Location (const int N, const char C, const int FromIndex, const int ToIndex) const |
| Returns the index of the nth occurrence of the character C in the string <me> from the starting index FromIndex to the ending index ToIndex. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range Example: before me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5 after me = "aabAa" returns 5. | |
| void | LowerCase () |
| Converts <me> to its lower-case equivalent. | |
| void | Prepend (const occ::handle< TCollection_HAsciiString > &other) |
| Inserts the other string at the beginning of the string <me> Example: before me = "cde" , S = "ab" after me = "abcde" , S = "ab". | |
| void | Print (Standard_OStream &astream) const |
| Prints this string on the stream <astream>. | |
| double | RealValue () const |
| Converts a string containing a numeric expression to a Real. Example: "215" returns 215.0. "3.14159267" returns 3.14159267. | |
| void | RemoveAll (const char C, const bool CaseSensitive) |
| Remove all the occurrences of the character C in the string Example: before me = "HellLLo", C = 'L' , CaseSensitive = True after me = "Hello". | |
| void | RemoveAll (const char what) |
| Removes every <what> characters from <me> | |
| void | Remove (const int where, const int ahowmany=1) |
| Erases <ahowmany> characters from position <where>, <where> included. Example: aString contains "Hello" aString.Erase(2,2) erases 2 characters from position 1 This gives "Hlo". | |
| void | RightAdjust () |
| Removes all space characters at the end of the string. | |
| void | RightJustify (const int Width, const char Filler) |
| Right justify. Length becomes equal to Width and the new characters are equal to Filler if Width < Length nothing happens Raises an exception if Width is less than zero Example: before me = "abcdef" , Width = 9 , Filler = ' ' after me = " abcdef". | |
| int | Search (const char *const what) const |
| Searches a CString in <me> from the beginning and returns position of first item <what> matching. It returns -1 if not found. Example: aString contains "Sample single test" aString.Search("le") returns 5. | |
| int | Search (const occ::handle< TCollection_HAsciiString > &what) const |
| Searches a String in <me> from the beginning and returns position of first item <what> matching. it returns -1 if not found. | |
| int | SearchFromEnd (const char *const what) const |
| Searches a CString in a String from the end and returns position of first item <what> matching. It returns -1 if not found. Example: aString contains "Sample single test" aString.SearchFromEnd("le") returns 12. | |
| int | SearchFromEnd (const occ::handle< TCollection_HAsciiString > &what) const |
| Searches a HAsciiString in another HAsciiString from the end and returns position of first item <what> matching. It returns -1 if not found. | |
| void | SetValue (const int where, const char what) |
| Replaces one character in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage". | |
| void | SetValue (const int where, const char *const what) |
| Replaces a part of <me> in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage". | |
| void | SetValue (const int where, const occ::handle< TCollection_HAsciiString > &what) |
| Replaces a part of <me> by another string. | |
| occ::handle< TCollection_HAsciiString > | Split (const int where) |
| Splits a HAsciiString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg". | |
| occ::handle< TCollection_HAsciiString > | SubString (const int FromIndex, const int ToIndex) const |
| Creation of a sub-string of the string <me>. The sub-string starts to the index Fromindex and ends to the index ToIndex. Raises an exception if ToIndex or FromIndex is out of bounds Example: before me = "abcdefg", ToIndex=3, FromIndex=6 after me = "abcdefg" returns "cdef". | |
| const char * | ToCString () const |
| Returns pointer to string (char *) This is useful for some casual manipulations Because this "char *" is 'const', you can't modify its contents. | |
| occ::handle< TCollection_HAsciiString > | Token (const char *const separators=" \t", const int whichone=1) const |
| Extracts <whichone> token from <me>. By default, the <separators> is set to space and tabulation. By default, the token extracted is the first one (whichone = 1). <separators> contains all separators you need. If no token indexed by <whichone> is found, it returns an empty String. Example: aString contains "This is a message" aString.Token() returns "This" aString.Token(" ",4) returns "message" aString.Token(" ",2) returns "is" aString.Token(" ",9) returns "" Other separators than space character and tabulation are allowed aString contains "1234; test:message , value" aString.Token("; :,",4) returns "value" aString.Token("; :,",2) returns "test". | |
| void | Trunc (const int ahowmany) |
| Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel". | |
| void | UpperCase () |
| Converts <me> to its upper-case equivalent. | |
| int | UsefullLength () const |
| Length of the string ignoring all spaces (' ') and the control character at the end. | |
| char | Value (const int where) const |
| Returns character at position <where> in <me>. If <where> is less than zero or greater than the length of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'. | |
| const TCollection_AsciiString & | String () const |
| Returns the field myString. | |
| bool | IsSameState (const occ::handle< TCollection_HAsciiString > &other) const |
Public Member Functions inherited from Standard_Transient | |
| Standard_Transient () | |
| Empty constructor. | |
| Standard_Transient (const Standard_Transient &) | |
| Copy constructor – does nothing. | |
| Standard_Transient & | operator= (const Standard_Transient &) |
| Assignment operator, needed to avoid copying reference counter. | |
| virtual | ~Standard_Transient ()=default |
| Destructor must be virtual. | |
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| Returns a type descriptor about this object. | |
| bool | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| Returns a true value if this is an instance of Type. | |
| bool | IsInstance (const char *const theTypeName) const |
| Returns a true value if this is an instance of TypeName. | |
| bool | IsKind (const opencascade::handle< Standard_Type > &theType) const |
| Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| bool | IsKind (const char *const theTypeName) const |
| Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| Standard_Transient * | This () const |
| Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
| int | GetRefCount () const noexcept |
| Get the reference counter of this object. | |
| void | IncrementRefCounter () noexcept |
| Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations. | |
| int | DecrementRefCounter () noexcept |
| Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement. | |
| virtual void | Delete () const |
| Memory deallocator for transient classes. | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
| typedef void | base_type |
| Returns a type descriptor about this object. | |
Static Public Member Functions inherited from Standard_Transient | |
| static constexpr const char * | get_type_name () |
| Returns a type descriptor about this object. | |
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| Returns type descriptor of Standard_Transient class. | |
A variable-length sequence of ASCII characters (normal 8-bit character type). It provides editing operations with built-in memory management to make HAsciiString objects easier to use than ordinary character arrays. HAsciiString objects are handles to strings.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | ) |
Initializes a HAsciiString to an empty AsciiString.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const char *const | message | ) |
Initializes a HAsciiString with a CString.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const char | aChar | ) |
Initializes a HAsciiString with a single character.
Initializes a HAsciiString with <length> space allocated. and filled with <filler>.This is useful for buffers.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const int | value | ) |
Initializes a HAsciiString with an integer value.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const double | value | ) |
Initializes a HAsciiString with a real value.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const TCollection_AsciiString & | aString | ) |
Initializes a HAsciiString with a AsciiString.
|
inlinenoexcept |
Initializes a HAsciiString with a AsciiString.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const occ::handle< TCollection_HAsciiString > & | aString | ) |
Initializes a HAsciiString with a HAsciiString.
| TCollection_HAsciiString::TCollection_HAsciiString | ( | const occ::handle< TCollection_HExtendedString > & | aString, |
| const char | replaceNonAscii ) |
Initializes a HAsciiString with a HExtendedString. If replaceNonAscii is non-null character, it will be used in place of any non-ascii character found in the source string. Otherwise, creates UTF-8 unicode string.
| void TCollection_HAsciiString::AssignCat | ( | const occ::handle< TCollection_HAsciiString > & | other | ) |
Appends <other> to me. Example: aString = aString + anotherString.
| void TCollection_HAsciiString::Capitalize | ( | ) |
Converts the first character into its corresponding upper-case character and the other characters into lowercase. Example: before me = "hellO " after me = "Hello ".
| occ::handle< TCollection_HAsciiString > TCollection_HAsciiString::Cat | ( | const char *const | other | ) | const |
Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString aString = aString + "Dummy" aString contains "I say " aString = aString + "Hello " + "Dolly" gives "I say Hello Dolly" Warning: To catenate more than one CString, you must put a String before. So the following example is WRONG ! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED This rule is applicable to AssignCat (operator +=) too.
| occ::handle< TCollection_HAsciiString > TCollection_HAsciiString::Cat | ( | const occ::handle< TCollection_HAsciiString > & | other | ) | const |
Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString.
Modifies this ASCII string so that its length becomes equal to Width and the new characters are equal to Filler. New characters are added both at the beginning and at the end of this string. If Width is less than the length of this ASCII string, nothing happens. Example occ::handle<TCollection_HAsciiString> myAlphabet = new TCollection_HAsciiString ("abcdef"); myAlphabet->Center(9,' '); assert ( !strcmp( myAlphabet->ToCString(), " abcdef ") );.
| void TCollection_HAsciiString::ChangeAll | ( | const char | aChar, |
| const char | NewChar, | ||
| const bool | CaseSensitive = true ) |
Replaces all characters equal to aChar by NewChar in this ASCII string. The substitution is case sensitive if CaseSensitive is true (default value). If you do not use the default case sensitive option, it does not matter whether aChar is upper-case or not. Example occ::handle<TCollection_HAsciiString> myMistake = new TCollection_HAsciiString ("Hather"); myMistake->ChangeAll('H','F'); assert ( !strcmp( myMistake->ToCString(), "Father") );.
| void TCollection_HAsciiString::Clear | ( | ) |
Removes all characters contained in <me>. This produces an empty HAsciiString.
| int TCollection_HAsciiString::FirstLocationInSet | ( | const occ::handle< TCollection_HAsciiString > & | Set, |
| const int | FromIndex, | ||
| const int | ToIndex ) const |
Returns the index of the first character of <me> that is present in <Set>. The search begins to the index FromIndex and ends to the the index ToIndex. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range Example: before me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 after me = "aabAcAa" returns 1.
| int TCollection_HAsciiString::FirstLocationNotInSet | ( | const occ::handle< TCollection_HAsciiString > & | Set, |
| const int | FromIndex, | ||
| const int | ToIndex ) const |
Returns the index of the first character of <me> that is not present in the set <Set>. The search begins to the index FromIndex and ends to the the index ToIndex in <me>. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range. Example: before me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 after me = "aabAcAa" returns 3.
Insert a HAsciiString at position <where>.
Insert a Character at position <where>. Example: aString contains "hy not ?" aString.Insert(1,'W'); gives "Why not ?" aString contains "Wh" aString.Insert(3,'y'); gives "Why" aString contains "Way" aString.Insert(2,'h'); gives "Why".
| void TCollection_HAsciiString::Insert | ( | const int | where, |
| const occ::handle< TCollection_HAsciiString > & | what ) |
Insert a HAsciiString at position <where>.
| void TCollection_HAsciiString::InsertAfter | ( | const int | Index, |
| const occ::handle< TCollection_HAsciiString > & | other ) |
Inserts the other ASCII string a after a specific index in the string <me> Example: before me = "cde" , Index = 0 , other = "ab" after me = "abcde" , other = "ab".
| void TCollection_HAsciiString::InsertBefore | ( | const int | Index, |
| const occ::handle< TCollection_HAsciiString > & | other ) |
Inserts the other ASCII string a before a specific index in the string <me> Raises an exception if Index is out of bounds Example: before me = "cde" , Index = 1 , other = "ab" after me = "abcde" , other = "ab".
| int TCollection_HAsciiString::IntegerValue | ( | ) | const |
Converts a HAsciiString containing a numeric expression to an Integer. Example: "215" returns 215.
| bool TCollection_HAsciiString::IsAscii | ( | ) | const |
Returns True if the string contains only ASCII characters between ' ' and '~'. This means no control character and no extended ASCII code.
| bool TCollection_HAsciiString::IsDifferent | ( | const occ::handle< TCollection_HAsciiString > & | S | ) | const |
Returns True if the string S not contains same characters than the string <me>.
| bool TCollection_HAsciiString::IsEmpty | ( | ) | const |
Returns True if the string <me> contains zero character.
| bool TCollection_HAsciiString::IsGreater | ( | const occ::handle< TCollection_HAsciiString > & | other | ) | const |
Returns TRUE if <me> is 'ASCII' greater than <other>.
| bool TCollection_HAsciiString::IsIntegerValue | ( | ) | const |
Returns True if the string contains an integer value.
| bool TCollection_HAsciiString::IsLess | ( | const occ::handle< TCollection_HAsciiString > & | other | ) | const |
Returns TRUE if <me> is 'ASCII' less than <other>.
| bool TCollection_HAsciiString::IsRealValue | ( | ) | const |
Returns True if the string contains a real value.
| bool TCollection_HAsciiString::IsSameState | ( | const occ::handle< TCollection_HAsciiString > & | other | ) | const |
| bool TCollection_HAsciiString::IsSameString | ( | const occ::handle< TCollection_HAsciiString > & | S | ) | const |
Returns True if the string S contains same characters than the string <me>.
| bool TCollection_HAsciiString::IsSameString | ( | const occ::handle< TCollection_HAsciiString > & | S, |
| const bool | CaseSensitive ) const |
Returns True if the string S contains same characters than the string <me>.
| void TCollection_HAsciiString::LeftAdjust | ( | ) |
Removes all space characters in the beginning of the string.
Left justify. Length becomes equal to Width and the new characters are equal to Filler if Width < Length nothing happens Raises an exception if Width is less than zero Example: before me = "abcdef" , Width = 9 , Filler = ' ' after me = "abcdef ".
| int TCollection_HAsciiString::Length | ( | ) | const |
Returns number of characters in <me>. This is the same functionality as 'strlen' in C.
| int TCollection_HAsciiString::Location | ( | const int | N, |
| const char | C, | ||
| const int | FromIndex, | ||
| const int | ToIndex ) const |
Returns the index of the nth occurrence of the character C in the string <me> from the starting index FromIndex to the ending index ToIndex. Returns zero if failure. Raises an exception if FromIndex or ToIndex is out of range Example: before me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5 after me = "aabAa" returns 5.
| int TCollection_HAsciiString::Location | ( | const occ::handle< TCollection_HAsciiString > & | other, |
| const int | FromIndex, | ||
| const int | ToIndex ) const |
returns an index in the string <me> of the first occurrence of the string S in the string <me> from the starting index FromIndex to the ending index ToIndex returns zero if failure Raises an exception if FromIndex or ToIndex is out of range. Example: before me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7 after me = "aabAaAa" returns 4
| void TCollection_HAsciiString::LowerCase | ( | ) |
Converts <me> to its lower-case equivalent.
| void TCollection_HAsciiString::Prepend | ( | const occ::handle< TCollection_HAsciiString > & | other | ) |
Inserts the other string at the beginning of the string <me> Example: before me = "cde" , S = "ab" after me = "abcde" , S = "ab".
| void TCollection_HAsciiString::Print | ( | Standard_OStream & | astream | ) | const |
Prints this string on the stream <astream>.
| double TCollection_HAsciiString::RealValue | ( | ) | const |
Converts a string containing a numeric expression to a Real. Example: "215" returns 215.0. "3.14159267" returns 3.14159267.
Erases <ahowmany> characters from position <where>, <where> included. Example: aString contains "Hello" aString.Erase(2,2) erases 2 characters from position 1 This gives "Hlo".
Remove all the occurrences of the character C in the string Example: before me = "HellLLo", C = 'L' , CaseSensitive = True after me = "Hello".
Removes every <what> characters from <me>
| void TCollection_HAsciiString::RightAdjust | ( | ) |
Removes all space characters at the end of the string.
Right justify. Length becomes equal to Width and the new characters are equal to Filler if Width < Length nothing happens Raises an exception if Width is less than zero Example: before me = "abcdef" , Width = 9 , Filler = ' ' after me = " abcdef".
Searches a CString in <me> from the beginning and returns position of first item <what> matching. It returns -1 if not found. Example: aString contains "Sample single test" aString.Search("le") returns 5.
| int TCollection_HAsciiString::Search | ( | const occ::handle< TCollection_HAsciiString > & | what | ) | const |
Searches a String in <me> from the beginning and returns position of first item <what> matching. it returns -1 if not found.
Searches a CString in a String from the end and returns position of first item <what> matching. It returns -1 if not found. Example: aString contains "Sample single test" aString.SearchFromEnd("le") returns 12.
| int TCollection_HAsciiString::SearchFromEnd | ( | const occ::handle< TCollection_HAsciiString > & | what | ) | const |
Searches a HAsciiString in another HAsciiString from the end and returns position of first item <what> matching. It returns -1 if not found.
Replaces a part of <me> in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage".
Replaces one character in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage".
| void TCollection_HAsciiString::SetValue | ( | const int | where, |
| const occ::handle< TCollection_HAsciiString > & | what ) |
Replaces a part of <me> by another string.
| occ::handle< TCollection_HAsciiString > TCollection_HAsciiString::Split | ( | const int | where | ) |
Splits a HAsciiString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg".
| const TCollection_AsciiString & TCollection_HAsciiString::String | ( | ) | const |
Returns the field myString.
| occ::handle< TCollection_HAsciiString > TCollection_HAsciiString::SubString | ( | const int | FromIndex, |
| const int | ToIndex ) const |
Creation of a sub-string of the string <me>. The sub-string starts to the index Fromindex and ends to the index ToIndex. Raises an exception if ToIndex or FromIndex is out of bounds Example: before me = "abcdefg", ToIndex=3, FromIndex=6 after me = "abcdefg" returns "cdef".
| const char * TCollection_HAsciiString::ToCString | ( | ) | const |
Returns pointer to string (char *) This is useful for some casual manipulations Because this "char *" is 'const', you can't modify its contents.
| occ::handle< TCollection_HAsciiString > TCollection_HAsciiString::Token | ( | const char *const | separators = " \t", |
| const int | whichone = 1 ) const |
Extracts <whichone> token from <me>. By default, the <separators> is set to space and tabulation. By default, the token extracted is the first one (whichone = 1). <separators> contains all separators you need. If no token indexed by <whichone> is found, it returns an empty String. Example: aString contains "This is a message" aString.Token() returns "This" aString.Token(" ",4) returns "message" aString.Token(" ",2) returns "is" aString.Token(" ",9) returns "" Other separators than space character and tabulation are allowed aString contains "1234; test:message , value" aString.Token("; :,",4) returns "value" aString.Token("; :,",2) returns "test".
Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel".
| void TCollection_HAsciiString::UpperCase | ( | ) |
Converts <me> to its upper-case equivalent.
| int TCollection_HAsciiString::UsefullLength | ( | ) | const |
Length of the string ignoring all spaces (' ') and the control character at the end.
Returns character at position <where> in <me>. If <where> is less than zero or greater than the length of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'.