StrArray get/set elements

Web Site  Methods

 

StrArray::GetAt
Equivalent to: const-returning operator []

 
const Str& GetAt (int index) const
const Str& operator[] (int index) const

Return the element at the specified 0-based index. The returned element cannot be modified.

 

 

StrArray::ElementAt
Equivalent to: non-const-returning operator []

 
Str& ElementAt (int index)
Str& operator[] (int index)

Similar to GetAt, but returns a non-const reference to the specified array element. Modifying the content of the returned object is allowed.

 

 
StrArray::SetAt
 
void SetAt (int index, const STRCHAR* elem)
void SetAt (int index, const Str& elem)
void SetAt (int index, const CString& elem)
The third overload is available only for modules using MFC

The SetAt method will set the string at the specified 0-based index to the specified value. SetAt will throw an exception if the passed index references an element beyond the current size of the array.

 

 
StrArray::SetAtGrow
 
void SetAtGrow (int index, const STRCHAR* elem)
void SetAtGrow (int index, const Str& elem)
void SetAtGrow (int index, const CString& elem)
The third overload is available only for modules using MFC

SetAtGrow is similar to SetAt; it will set the string at the specified 0-based index.  However, if the index is higher than the current array upper limit, the array size is increased to accomodate the new element.  If the array size must be increased by more than one, elements between the current upper limit and the newly stored element will be initialized to an empty string.

 

See alsoStrArray class