宣告字串
string s="abcd";
string rs(s.rbegin(),s.rend()); //rs="dcba" reverse(s.begin(),s.end()); //s="dcba"
s="1,2,3,4"; //將字串s中的','全部轉成空白' ' replace(s.begin(),s.end(),',',' '); //<algorithm> //s="1 2 3 4"
Last updated 6 years ago
Was this helpful?