Dela via


CSimpleStringT::operator []

Call this function to access a single character of the character array.

XCHAR operator[]( 
   int iChar 
) const;

Parameters

  • iChar
    Zero-based index of a character in the string.

Remarks

The overloaded subscript ([]) operator returns a single character specified by the zero-based index in iChar. This operator is a convenient substitute for the GetAt member function.

Note

You can use the subscript ([]) operator to get the value of a character in a CSimpleStringT, but you cannot use it to change the value of a character in a CSimpleStringT.

Example

The following example demonstrates the use of CSimpleStringT::operator [].

CSimpleString s(_T("abc"), pMgr);
ASSERT(s[1] == _T('b'));   

Requirements

Header: atlsimpstr.h

See Also

Reference

CSimpleStringT Class

CSimpleStringT::SetAt

Other Resources

CSimpleStringT Members