CString str = " Hello "; str.TrimRight(); // removes all the trailing white spaces trace(str); // prints " Hello"
CString str = " \t Hello \n\r "; str.TrimRight(); // removes all the trailing white spaces and new lines trace(str); // prints " \t Hello"
CString str = ""; str.TrimRight(); // does nothing since there are no trailing white spacesOverall, the TrimRight function is a useful tool for removing unnecessary white spaces from CString objects.