我有以下字符串:
https://example.com/get/ea34b8062cr2533eed0b4302e44d4090e26ae3c01bb1124292f3c970_1280.jpg
我只想从这部分 https
中删除字符 s
并再次返回整个字符串,但没有 s
字符。
wxString imgURL = "https://example.com/get/ea34b8062cr2533eed0b4302e44d4090e26ae3c01bb1124292f3c970_1280.jpg";
imgURL.Remove(imgURL.find('s'));
this->m_textShowData->SetValue(imgURL);
不幸的是,前面的代码删除了 s
字符,但没有再次返回整个字符串,而是仅返回 http
。
如何删除字符 s
然后返回没有该字符的整个字符串?
最佳答案
只需使用删除功能:
imgURL.erase(4,1);
关于c++ - 从长字符串中删除一个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49130449/