我有以下字符串:https://example.com/get/ea34b8062cr2533eed0b4302e44d4090e26ae3c01bb1124292f3c970_1280.jpg
我只想从这部分s
中删除字符https
并再次返回整个字符串,但不包含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/