📜  如何在 C++ 代码示例中轻松修剪 str

📅  最后修改于: 2022-03-11 14:44:45.775000             🧑  作者: Mango

代码示例1
#include 
using namespace std;

string trim(string value, int start, int end, int jump = 1) 
{
    string Newstr;
    for (int idx = start; idx <= (end - start) + 1; idx += jump)
    {
        Newstr += value[idx];
    }

    return Newstr;
}

int main()
{
    cout << trim("Mystring", 2, 5) << endl; //str
}