#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
}
#include <boost/algorithm/string.hpp>
std::string str("hello world! ");
boost::trim_right(str);
Code Example |
---|
Cpp :: double to int c++ |
Cpp :: convert integer to string c++ |
Cpp :: C++ cin cout |
Cpp :: count number of set bits C++ |
Cpp :: find max element in array c++ |
Cpp :: glew32.dll was not found |
Cpp :: casting c++ |
Cpp :: c++ get character from string |
Cpp :: append string cpp |
Cpp :: how to use char in c++ |
Cpp :: how to split a string in c++ |
Cpp :: set clear c++ |
Cpp :: are strings mutable in c++ |
Cpp :: cpp loop through object |
Cpp :: initialize vector of vector c++ |
Cpp :: find prime number c++ |
Cpp :: overload of << c++ |
Cpp :: c++ program to print natural numbers from 1 to 10 in reverse order using while loop |
Cpp :: memmove |
Cpp :: function in struct c++ |
Cpp :: cpp getter as const |
Cpp :: c++ cout without include iostream |
Cpp :: cpp while |
Cpp :: struct c++ |
Cpp :: matrix dynamic memory c++ |
Cpp :: c++ Least prime factor of numbers till n |
Cpp :: find a number in vector c++ |
Cpp :: map in cpp |
Cpp :: Traversing a C++ Array |
Cpp :: exponent of x using c c++ |