Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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
}
 
PREVIOUS NEXT
Tagged: #easily #trim #str
ADD COMMENT
Topic
Name
4+4 =