我想text=s-o-m-e=text
喜欢的replaceAll替换字符(字符串,开始,结束, '_', ' - ')
替换字符串text=s_o_m_e=text
我有一个起始和结束索引:
std::string str("text=s_o_m_e=text");
std::string::size_type start = str.find("text="), end;
if (start != std::string::npos) {
end = str.find("=", start);
if (end != std::string::npos) {
//...
}
}
所以,我正在寻找这样的功能:
replaceAll(string, start, end, '_', '-');
UP:
谢谢,Blastfurnace
[此问题]的完全重复(http://stackoverflow.com/questions/2896600/how-to-replace-all-occurrences-of-a-character-in-string)。 –