ネタ元 → VB6→VB2005:MIDステートメント
文字列 "12345678" の(1-origionで)4番目を"a"に置き換える。
標準C++: basic_string では:
#include <iostream>
#include <string>
using namespace std;
int main() {
string target = "12345678";
int pos = 4;
target.replace(pos-1,1,"a"); // 位置, 長さ, 置換文字列
cout << target;
}
…ってなります。
部分文字列を取り出すのは target.substr(位置,長さ) です。
こんなとこにも思想の違いが見え隠れしますなりねー