CString str = " hello world "; str.TrimLeft(); // removes leading whitespace
CString str = " hello world "; str.TrimRight(); // removes trailing whitespace
CString str = " hello world "; str.Trim(); // removes leading and trailing whitespaceAfter running this code, `str` will be set to `"hello world"`. The package library for CString Trim is the MFC library, specifically the CString class in the afxstr.h header file.