Answers for "how to easily trim a str in c++"

C++
1

how to easily trim a str in c++

#include <iostream>
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
}
Posted by: Guest on January-16-2022

Browse Popular Code Answers by Language