Compartir a través de


CHString::operator [] method

[The CHString class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

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

Syntax

WCHAR operator [](
    nIndex
);

Parameters

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

Remarks

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

 

Examples

The following code example shows the use of CHString::operator[]:

CHString s( L"abc" );
assert( s[1] == 'b' );

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

ChString.h (include FwCommon.h)

Library

FrameDyn.lib

DLL

FrameDynOS.dll; FrameDyn.dll

See also

CHString

CHString::GetAt