git-svn-id: http://apu.dw.local/svnusers/JoshHoltrop/pppc/trunk@51 8131a0b2-b21c-1c47-bd6a-f003126495bd
18 lines
379 B
C++
18 lines
379 B
C++
|
|
#include "trim.h"
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
string trim(const string & orig)
|
|
{
|
|
const char ws[] = " \t\r\n\v\f";
|
|
size_t first = orig.find_first_not_of(ws);
|
|
size_t last = orig.find_last_not_of(ws);
|
|
if (first == string::npos || last == string::npos)
|
|
{
|
|
return "";
|
|
}
|
|
return string(orig, first, last - first + 1);
|
|
}
|
|
|