Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
string S = "パタトクカシーー"
cout << S[0] // "パ"ではなく文字化けが表示される
// 3バイト分取得すればOKだった
size_t one_char = 3;
cout << S.substr(0, one_char); // "パ"
// パトカー抽出
for(int i = 0; i < one_char * 4; i++) {
cout << S.substr(i * one_char * 2, one_char); // パトカー
}
cout << endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment