#ifndef _NDS_TRIM_H
#define _NDS_TRIM_H
#include <string>
#include <algorithm>
#include <functional>
#include <cctype>
using namespace std;
namespace NDS
{
inline string& ltrim(string &ss)
{
string::iterator p=find_if(ss.begin(),ss.end(),not1(ptr_fun(isspace)));
ss.erase(ss.begin(),p);
return ss;
}
inline string& rtrim(string &ss)
{
string::reverse_iterator p=find_if(ss.rbegin(),ss.rend(),not1(ptr_fun(isspac
e)));
ss.erase(p.base(),ss.end());
return ss;
}
inline string& trim(string &st)
{
ltrim(rtrim(st));
return st;
}
}
#endif