CString str("Hello world!"); char ch = str.GetAt(6); // retrieves the character 'w'
CString str("Hello world!"); CString sub = str.Mid(3, 5); // retrieves the substring "lo wo"In this example, the Mid method is used to retrieve a substring from the string "Hello world!" starting at index position 3 and ending after 5 characters (which corresponds to the substring "lo wo"). The CString class is included in the Microsoft Foundation Classes (MFC) library, which is a set of C++ classes that provide an object-oriented interface to various functions and features of the Windows operating system.