你能帮我得到 CString
中的 last word 吗?
string[] tokens = richTextBox1.Text.Split(' ');
lastword = ConvertToDouble(tokens[tokens.Length - 1]);
我有这个是 C#,但我需要在 C++ Windows 桌面应用程序中使用它。 编辑:我说了字,但我会拆分数字
最佳答案
您可以使用 CString::ReverseFind()
找到最后一个空格,然后使用 CString::Mid()
获取最后一个子字符串。
CString str;
.. str.ReverseFind(' '); // check result for >= 0
str.Mid(..);
关于C++ Cstring拆分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59334540/