开发者

Am I missing something here ? XD TrimRight does not seem to want to work

Ok, here is the small portion of开发者_JAVA技巧 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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜