C++/공백제거 trim Edit Diff Refresh Backlink Random Search History Help Setting Hide Show template 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(str, "\r"); str = TrimStr_Generic(str, "\n"); str = TrimStr_Generic(str, "\t"); str = TrimStr_Generic(str, " "); strcpy_s(source, str.length() + 1, str.c_str()); return source; } " testing 134 \r\n" ==> "testing 134" C++ trim 공백제거 템플릿 함수 이 글에는 0 개의 댓글이 있습니다. Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus