This topic has not yet been rated - Rate this topic

CSimpleStringT::GetAt

Returns one character from a CSimpleStringT object.

XCHAR GetAt(
   int iChar
) const;
iChar

Zero-based index of the character in the CSimpleStringT object. The iChar parameter must be greater than or equal to 0 and less than the value returned by GetLength. Otherwise, GetAt will generate an exception.

An XCHAR that contains the character at the specified position in the string.

Call this method to return the one character specified by iChar. The overloaded subscript ([]) operator is a convenient alias for GetAt. The null terminator is addressable without generating an exception by using GetAt. However, it is not counted by GetLength, and the value returned is 0.

The following example demonstrates how to use CSimpleStringT::GetAt.


CSimpleString s(_T("abcdef"), pMgr);
ASSERT(s.GetAt(2) == _T('c'));   


Header: atlsimpstr.h

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.