どのように2つの単語の間の文字列を返すのですか?たとえば:2つの単語の間の文字列を取得しますか?
STARThello how are you doing today?END
出力は次のようになります。
hello how are you doing today?
私はいつも、私はそれを行うことができるだろうか上の好奇心てきました。
std::string str = "STARThello how are you doing today?END";
const int startSize = 5; //or perharps something like startString.size()
const int endSize = 4; //or perharps something like stopString.size()
const int countSize = str.size() - (startSize + endSize);
std::string substring = str.substr(startSize, countSize);
は固定文字列の長さですか?見ますか'START'と' END'という言葉は固定されていますか、それとも 'BEGIN'や' END'のようなものでもありますか? –
STARTは文字列が始まる場所になり、ENDは文字列が終わるところになります。 – okay14
ああ、確かに!それも機能します。 – okay14