#keywords
{{{#!gcode
template<typename T>
inline T TrimStr_Generic(const T& Src, const T& c)
{
	int p2 = Src.find_last_not_of(c);
	if (p2 == T::npos) return T();
	int p1 = Src.find_first_not_of(c);
	if (p1 == T::npos) p1 = 0;
	return Src.substr(p1, (p2-p1)+1);
}

char* trim(char *source)
{
	std::string str(source);
	str = TrimStr_Generic<std::string>(str, "\n");
	str = TrimStr_Generic<std::string>(str, "\t");
	str = TrimStr_Generic<std::string>(str, " ");	
	strcpy_s(source, str.length() + 1, str.c_str());

	return source;
}
}}}
----
{{{
"  testing 134     \r\n" ==> "testing 134"
}}}