Open CASCADE Technology  7.3.0
Public Member Functions

TCollection_HAsciiString Class Reference

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>

Inheritance diagram for TCollection_HAsciiString:
Inheritance graph
[legend]

Public Member Functions

 TCollection_HAsciiString ()
 Initializes a HAsciiString to an empty AsciiString. More...
 
 TCollection_HAsciiString (const Standard_CString message)
 Initializes a HAsciiString with a CString. More...
 
 TCollection_HAsciiString (const Standard_Character aChar)
 Initializes a HAsciiString with a single character. More...
 
 TCollection_HAsciiString (const Standard_Integer length, const Standard_Character filler)
 Initializes a HAsciiString with <length> space allocated. and filled with <filler>.This is useful for buffers. More...
 
 TCollection_HAsciiString (const Standard_Integer value)
 Initializes a HAsciiString with an integer value. More...
 
 TCollection_HAsciiString (const Standard_Real value)
 Initializes a HAsciiString with a real value. More...
 
 TCollection_HAsciiString (const TCollection_AsciiString &aString)
 Initializes a HAsciiString with a HAsciiString. More...
 
 TCollection_HAsciiString (const Handle< TCollection_HAsciiString > &aString)
 Initializes a HAsciiString with a HAsciiString. More...
 
 TCollection_HAsciiString (const Handle< TCollection_HExtendedString > &aString, const Standard_Character replaceNonAscii)
 Initializes a HAsciiString with a HAsciiString. If replaceNonAscii is non-null charecter, it will be used in place of any non-ascii character found in the source string. Otherwise, raises OutOfRange exception if at least one character in the source string is not in the "Ascii range". More...
 
void AssignCat (const Standard_CString other)
 Appends <other> to me. More...
 
void AssignCat (const Handle< TCollection_HAsciiString > &other)
 Appends <other> to me. Example: aString = aString + anotherString. More...
 
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 ". More...
 
Handle< TCollection_HAsciiStringCat (const Standard_CString 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. More...
 
Handle< TCollection_HAsciiStringCat (const Handle< TCollection_HAsciiString > &other) const
 Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString. More...
 
void Center (const Standard_Integer Width, const Standard_Character 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 Handle(TCollection_HAsciiString) myAlphabet = new TCollection_HAsciiString ("abcdef"); myAlphabet->Center(9,' '); assert ( !strcmp( myAlphabet->ToCString(), " abcdef ") );. More...
 
void ChangeAll (const Standard_Character aChar, const Standard_Character NewChar, const Standard_Boolean CaseSensitive=Standard_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 Handle(TCollection_HAsciiString) myMistake = new TCollection_HAsciiString ("Hather"); myMistake->ChangeAll('H','F'); assert ( !strcmp( myMistake->ToCString(), "Father") );. More...
 
void Clear ()
 Removes all characters contained in <me>. This produces an empty HAsciiString. More...
 
Standard_Integer FirstLocationInSet (const Handle< TCollection_HAsciiString > &Set, const Standard_Integer FromIndex, const Standard_Integer 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. More...
 
Standard_Integer FirstLocationNotInSet (const Handle< TCollection_HAsciiString > &Set, const Standard_Integer FromIndex, const Standard_Integer 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. More...
 
void Insert (const Standard_Integer where, const Standard_Character 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". More...
 
void Insert (const Standard_Integer where, const Standard_CString what)
 Insert a HAsciiString at position <where>. More...
 
void Insert (const Standard_Integer where, const Handle< TCollection_HAsciiString > &what)
 Insert a HAsciiString at position <where>. More...
 
void InsertAfter (const Standard_Integer Index, const 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". More...
 
void InsertBefore (const Standard_Integer Index, const 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". More...
 
Standard_Boolean IsEmpty () const
 Returns True if the string <me> contains zero character. More...
 
Standard_Boolean IsLess (const Handle< TCollection_HAsciiString > &other) const
 Returns TRUE if <me> is 'ASCII' less than <other>. More...
 
Standard_Boolean IsGreater (const Handle< TCollection_HAsciiString > &other) const
 Returns TRUE if <me> is 'ASCII' greater than <other>. More...
 
Standard_Integer IntegerValue () const
 Converts a HAsciiString containing a numeric expression to an Integer. Example: "215" returns 215. More...
 
Standard_Boolean IsIntegerValue () const
 Returns True if the string contains an integer value. More...
 
Standard_Boolean IsRealValue () const
 Returns True if the string contains a real value. More...
 
Standard_Boolean IsAscii () const
 Returns True if the string contains only ASCII characters between ' ' and '~'. This means no control character and no extended ASCII code. More...
 
Standard_Boolean IsDifferent (const Handle< TCollection_HAsciiString > &S) const
 Returns True if the string S not contains same characters than the string <me>. More...
 
Standard_Boolean IsSameString (const Handle< TCollection_HAsciiString > &S) const
 Returns True if the string S contains same characters than the string <me>. More...
 
Standard_Boolean IsSameString (const Handle< TCollection_HAsciiString > &S, const Standard_Boolean CaseSensitive) const
 Returns True if the string S contains same characters than the string <me>. More...
 
void LeftAdjust ()
 Removes all space characters in the begining of the string. More...
 
void LeftJustify (const Standard_Integer Width, const Standard_Character 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 ". More...
 
Standard_Integer Length () const
 Returns number of characters in <me>. This is the same functionality as 'strlen' in C. More...
 
Standard_Integer Location (const Handle< TCollection_HAsciiString > &other, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const
 returns an index in the string <me> of the first occurence 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 More...
 
Standard_Integer Location (const Standard_Integer N, const Standard_Character C, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const
 Returns the index of the nth occurence 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. More...
 
void LowerCase ()
 Converts <me> to its lower-case equivalent. More...
 
void Prepend (const Handle< TCollection_HAsciiString > &other)
 Inserts the other string at the begining of the string <me> Example: before me = "cde" , S = "ab" after me = "abcde" , S = "ab". More...
 
void Print (Standard_OStream &astream) const
 Prints this string on the stream <astream>. More...
 
Standard_Real RealValue () const
 Converts a string containing a numeric expression to a Real. Example: "215" returns 215.0. "3.14159267" returns 3.14159267. More...
 
void RemoveAll (const Standard_Character C, const Standard_Boolean CaseSensitive)
 Remove all the occurences of the character C in the string Example: before me = "HellLLo", C = 'L' , CaseSensitive = True after me = "Hello". More...
 
void RemoveAll (const Standard_Character what)
 Removes every <what> characters from <me> More...
 
void Remove (const Standard_Integer where, const Standard_Integer 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". More...
 
void RightAdjust ()
 Removes all space characters at the end of the string. More...
 
void RightJustify (const Standard_Integer Width, const Standard_Character 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". More...
 
Standard_Integer Search (const Standard_CString 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. More...
 
Standard_Integer Search (const 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. More...
 
Standard_Integer SearchFromEnd (const Standard_CString 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. More...
 
Standard_Integer SearchFromEnd (const 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. More...
 
void SetValue (const Standard_Integer where, const Standard_Character 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". More...
 
void SetValue (const Standard_Integer where, const Standard_CString 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". More...
 
void SetValue (const Standard_Integer where, const Handle< TCollection_HAsciiString > &what)
 Replaces a part of <me> by another string. More...
 
Handle< TCollection_HAsciiStringSplit (const Standard_Integer where)
 Splits a HAsciiString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg". More...
 
Handle< TCollection_HAsciiStringSubString (const Standard_Integer FromIndex, const Standard_Integer 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". More...
 
Standard_CString 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. More...
 
Handle< TCollection_HAsciiStringToken (const Standard_CString separators=" \, const Standard_Integer 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". More...
 
void Trunc (const Standard_Integer ahowmany)
 Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel". More...
 
void UpperCase ()
 Converts <me> to its upper-case equivalent. More...
 
Standard_Integer UsefullLength () const
 Length of the string ignoring all spaces (' ') and the control character at the end. More...
 
Standard_Character Value (const Standard_Integer where) const
 Returns character at position <where> in <me>. If <where> is less than zero or greater than the lenght of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'. More...
 
const TCollection_AsciiStringString () const
 Returns the field myString. More...
 
Standard_Boolean IsSameState (const Handle< TCollection_HAsciiString > &other) const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean 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. More...
 
Standard_Boolean IsKind (const Standard_CString 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. More...
 
Standard_TransientThis () 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. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TCollection_HAsciiString() [1/9]

TCollection_HAsciiString::TCollection_HAsciiString ( )

Initializes a HAsciiString to an empty AsciiString.

◆ TCollection_HAsciiString() [2/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Standard_CString  message)

Initializes a HAsciiString with a CString.

◆ TCollection_HAsciiString() [3/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Standard_Character  aChar)

Initializes a HAsciiString with a single character.

◆ TCollection_HAsciiString() [4/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Standard_Integer  length,
const Standard_Character  filler 
)

Initializes a HAsciiString with <length> space allocated. and filled with <filler>.This is useful for buffers.

◆ TCollection_HAsciiString() [5/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Standard_Integer  value)

Initializes a HAsciiString with an integer value.

◆ TCollection_HAsciiString() [6/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Standard_Real  value)

Initializes a HAsciiString with a real value.

◆ TCollection_HAsciiString() [7/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const TCollection_AsciiString aString)

Initializes a HAsciiString with a HAsciiString.

◆ TCollection_HAsciiString() [8/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Handle< TCollection_HAsciiString > &  aString)

Initializes a HAsciiString with a HAsciiString.

◆ TCollection_HAsciiString() [9/9]

TCollection_HAsciiString::TCollection_HAsciiString ( const Handle< TCollection_HExtendedString > &  aString,
const Standard_Character  replaceNonAscii 
)

Initializes a HAsciiString with a HAsciiString. If replaceNonAscii is non-null charecter, it will be used in place of any non-ascii character found in the source string. Otherwise, raises OutOfRange exception if at least one character in the source string is not in the "Ascii range".

Member Function Documentation

◆ AssignCat() [1/2]

void TCollection_HAsciiString::AssignCat ( const Standard_CString  other)

Appends <other> to me.

◆ AssignCat() [2/2]

void TCollection_HAsciiString::AssignCat ( const Handle< TCollection_HAsciiString > &  other)

Appends <other> to me. Example: aString = aString + anotherString.

◆ Capitalize()

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 ".

◆ Cat() [1/2]

Handle< TCollection_HAsciiString > TCollection_HAsciiString::Cat ( const Standard_CString  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.

◆ Cat() [2/2]

Handle< TCollection_HAsciiString > TCollection_HAsciiString::Cat ( const Handle< TCollection_HAsciiString > &  other) const

Creates a new string by concatenation of this ASCII string and the other ASCII string. Example: aString = aString + anotherString.

◆ Center()

void TCollection_HAsciiString::Center ( const Standard_Integer  Width,
const Standard_Character  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 Handle(TCollection_HAsciiString) myAlphabet = new TCollection_HAsciiString ("abcdef"); myAlphabet->Center(9,' '); assert ( !strcmp( myAlphabet->ToCString(), " abcdef ") );.

◆ ChangeAll()

void TCollection_HAsciiString::ChangeAll ( const Standard_Character  aChar,
const Standard_Character  NewChar,
const Standard_Boolean  CaseSensitive = Standard_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 Handle(TCollection_HAsciiString) myMistake = new TCollection_HAsciiString ("Hather"); myMistake->ChangeAll('H','F'); assert ( !strcmp( myMistake->ToCString(), "Father") );.

◆ Clear()

void TCollection_HAsciiString::Clear ( )

Removes all characters contained in <me>. This produces an empty HAsciiString.

◆ FirstLocationInSet()

Standard_Integer TCollection_HAsciiString::FirstLocationInSet ( const Handle< TCollection_HAsciiString > &  Set,
const Standard_Integer  FromIndex,
const Standard_Integer  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.

◆ FirstLocationNotInSet()

Standard_Integer TCollection_HAsciiString::FirstLocationNotInSet ( const Handle< TCollection_HAsciiString > &  Set,
const Standard_Integer  FromIndex,
const Standard_Integer  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() [1/3]

void TCollection_HAsciiString::Insert ( const Standard_Integer  where,
const Standard_Character  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".

◆ Insert() [2/3]

void TCollection_HAsciiString::Insert ( const Standard_Integer  where,
const Standard_CString  what 
)

Insert a HAsciiString at position <where>.

◆ Insert() [3/3]

void TCollection_HAsciiString::Insert ( const Standard_Integer  where,
const Handle< TCollection_HAsciiString > &  what 
)

Insert a HAsciiString at position <where>.

◆ InsertAfter()

void TCollection_HAsciiString::InsertAfter ( const Standard_Integer  Index,
const 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".

◆ InsertBefore()

void TCollection_HAsciiString::InsertBefore ( const Standard_Integer  Index,
const 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".

◆ IntegerValue()

Standard_Integer TCollection_HAsciiString::IntegerValue ( ) const

Converts a HAsciiString containing a numeric expression to an Integer. Example: "215" returns 215.

◆ IsAscii()

Standard_Boolean 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.

◆ IsDifferent()

Standard_Boolean TCollection_HAsciiString::IsDifferent ( const Handle< TCollection_HAsciiString > &  S) const

Returns True if the string S not contains same characters than the string <me>.

◆ IsEmpty()

Standard_Boolean TCollection_HAsciiString::IsEmpty ( ) const

Returns True if the string <me> contains zero character.

◆ IsGreater()

Standard_Boolean TCollection_HAsciiString::IsGreater ( const Handle< TCollection_HAsciiString > &  other) const

Returns TRUE if <me> is 'ASCII' greater than <other>.

◆ IsIntegerValue()

Standard_Boolean TCollection_HAsciiString::IsIntegerValue ( ) const

Returns True if the string contains an integer value.

◆ IsLess()

Standard_Boolean TCollection_HAsciiString::IsLess ( const Handle< TCollection_HAsciiString > &  other) const

Returns TRUE if <me> is 'ASCII' less than <other>.

◆ IsRealValue()

Standard_Boolean TCollection_HAsciiString::IsRealValue ( ) const

Returns True if the string contains a real value.

◆ IsSameState()

Standard_Boolean TCollection_HAsciiString::IsSameState ( const Handle< TCollection_HAsciiString > &  other) const

◆ IsSameString() [1/2]

Standard_Boolean TCollection_HAsciiString::IsSameString ( const Handle< TCollection_HAsciiString > &  S) const

Returns True if the string S contains same characters than the string <me>.

◆ IsSameString() [2/2]

Standard_Boolean TCollection_HAsciiString::IsSameString ( const Handle< TCollection_HAsciiString > &  S,
const Standard_Boolean  CaseSensitive 
) const

Returns True if the string S contains same characters than the string <me>.

◆ LeftAdjust()

void TCollection_HAsciiString::LeftAdjust ( )

Removes all space characters in the begining of the string.

◆ LeftJustify()

void TCollection_HAsciiString::LeftJustify ( const Standard_Integer  Width,
const Standard_Character  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 ".

◆ Length()

Standard_Integer TCollection_HAsciiString::Length ( ) const

Returns number of characters in <me>. This is the same functionality as 'strlen' in C.

◆ Location() [1/2]

Standard_Integer TCollection_HAsciiString::Location ( const Handle< TCollection_HAsciiString > &  other,
const Standard_Integer  FromIndex,
const Standard_Integer  ToIndex 
) const

returns an index in the string <me> of the first occurence 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

◆ Location() [2/2]

Standard_Integer TCollection_HAsciiString::Location ( const Standard_Integer  N,
const Standard_Character  C,
const Standard_Integer  FromIndex,
const Standard_Integer  ToIndex 
) const

Returns the index of the nth occurence 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.

◆ LowerCase()

void TCollection_HAsciiString::LowerCase ( )

Converts <me> to its lower-case equivalent.

◆ Prepend()

void TCollection_HAsciiString::Prepend ( const Handle< TCollection_HAsciiString > &  other)

Inserts the other string at the begining of the string <me> Example: before me = "cde" , S = "ab" after me = "abcde" , S = "ab".

◆ Print()

void TCollection_HAsciiString::Print ( Standard_OStream astream) const

Prints this string on the stream <astream>.

◆ RealValue()

Standard_Real TCollection_HAsciiString::RealValue ( ) const

Converts a string containing a numeric expression to a Real. Example: "215" returns 215.0. "3.14159267" returns 3.14159267.

◆ Remove()

void TCollection_HAsciiString::Remove ( const Standard_Integer  where,
const Standard_Integer  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".

◆ RemoveAll() [1/2]

void TCollection_HAsciiString::RemoveAll ( const Standard_Character  C,
const Standard_Boolean  CaseSensitive 
)

Remove all the occurences of the character C in the string Example: before me = "HellLLo", C = 'L' , CaseSensitive = True after me = "Hello".

◆ RemoveAll() [2/2]

void TCollection_HAsciiString::RemoveAll ( const Standard_Character  what)

Removes every <what> characters from <me>

◆ RightAdjust()

void TCollection_HAsciiString::RightAdjust ( )

Removes all space characters at the end of the string.

◆ RightJustify()

void TCollection_HAsciiString::RightJustify ( const Standard_Integer  Width,
const Standard_Character  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".

◆ Search() [1/2]

Standard_Integer TCollection_HAsciiString::Search ( const Standard_CString  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.

◆ Search() [2/2]

Standard_Integer TCollection_HAsciiString::Search ( const 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.

◆ SearchFromEnd() [1/2]

Standard_Integer TCollection_HAsciiString::SearchFromEnd ( const Standard_CString  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.

◆ SearchFromEnd() [2/2]

Standard_Integer TCollection_HAsciiString::SearchFromEnd ( const 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.

◆ SetValue() [1/3]

void TCollection_HAsciiString::SetValue ( const Standard_Integer  where,
const Standard_Character  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".

◆ SetValue() [2/3]

void TCollection_HAsciiString::SetValue ( const Standard_Integer  where,
const Standard_CString  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".

◆ SetValue() [3/3]

void TCollection_HAsciiString::SetValue ( const Standard_Integer  where,
const Handle< TCollection_HAsciiString > &  what 
)

Replaces a part of <me> by another string.

◆ Split()

Handle< TCollection_HAsciiString > TCollection_HAsciiString::Split ( const Standard_Integer  where)

Splits a HAsciiString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg".

◆ String()

const TCollection_AsciiString& TCollection_HAsciiString::String ( ) const

Returns the field myString.

◆ SubString()

Handle< TCollection_HAsciiString > TCollection_HAsciiString::SubString ( const Standard_Integer  FromIndex,
const Standard_Integer  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".

◆ ToCString()

Standard_CString 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.

◆ Token()

Handle< TCollection_HAsciiString > TCollection_HAsciiString::Token ( )

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".

◆ Trunc()

void TCollection_HAsciiString::Trunc ( const Standard_Integer  ahowmany)

Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel".

◆ UpperCase()

void TCollection_HAsciiString::UpperCase ( )

Converts <me> to its upper-case equivalent.

◆ UsefullLength()

Standard_Integer TCollection_HAsciiString::UsefullLength ( ) const

Length of the string ignoring all spaces (' ') and the control character at the end.

◆ Value()

Standard_Character TCollection_HAsciiString::Value ( const Standard_Integer  where) const

Returns character at position <where> in <me>. If <where> is less than zero or greater than the lenght of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'.


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