CSimpleStringT::GetAt
Returns one character from a CSimpleStringT object.
XCHAR GetAt(
int iChar
) const;
Parameters
- 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.
Return Value
An XCHAR that contains the character at the specified position in the string.
Remarks
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.
Example
The following example demonstrates how to use CSimpleStringT::GetAt.
CSimpleString s(_T("abcdef"), pMgr);
ASSERT(s.GetAt(2) == _T('c'));
Requirements
Header: atlsimpstr.h
See Also
Reference
Other Resources
Change History
Date |
History |
Reason |
---|---|---|
October 2009 |
Added what occurs when the GetAt parameter is out of bounds for the string. |
Customer feedback. |