【发布时间】:2011-01-19 15:16:37
【问题描述】:
如何从 C++ 字符串中删除最后一个字符?
我试过st = substr(st.length()-1);,但没用。
【问题讨论】:
-
你想要一个删除了最后一个字符的新字符串还是没有最后一个字符的相同字符串?
-
对于 MFC Visual C++ CString:
CString str=CString("Hello world"); str.Delete(str.GetLength()-1);