0

Ok, here is the small portion of code to demonstrate:

CString txt = _T("Hello World");
CString txt2 = txt;
txt2.TrimRight('W');
AfxMessageBox(txt2);

The output is "Hello World".

What am I not getting right ?

Simon
  • 277
  • 1
  • 5
  • 13

1 Answers1

0

The call txt2.TrimRight('W'); removes all characters 'W' from the right side of the string. Since "Hello World" does not end in 'W' nothing is trimmed at all.

Howard
  • 38,639
  • 9
  • 64
  • 83
  • I thought it removed all characters to the right of the string after the W, I get the difference now thanks – Simon Apr 15 '11 at 17:56