CString::Mid
This method extracts a substring of length nCount characters from this CString object, starting at position nFirst (zero-based). The method returns a copy of the extracted substring. Mid is similar to the Basic MID$ function, except that indexes are zero-based.
CString Mid(
int nFirst,
int nCount )
const;
CString Mid(
int nFirst )
const;
Parameters
- nFirst
Specifies the zero-based index of the first character in this CString object that is to be included in the extracted substring. - nCount
Specifies the number of characters to extract from this CString object. If this parameter is not supplied, the remainder of the string is extracted.
Return Value
A CString object that contains a copy of the specified range of characters. Note that the returned CString object may be empty.
Example
The following example demonstrates the use of CString::Mid.
// example for CString::Mid CString s( _T("abcdef") ); ASSERT( s.Mid( 2, 3 ) == _T("cde") );
Requirements
Windows CE versions: 1.0 and later
Header file: Declared in Afx.h
Platform: H/PC Pro, Palm-size PC, Pocket PC