Platinum Partner

C++ String Trim Blanks

// description of your code here


#include
#include
using namespace std;

#define SPACES " \t\r\n"

inline string trim_right (const string & s, const string & t = SPACES)
{
    string d (s);
    string::size_type i (d.find_last_not_of (t));
    if (i == string::npos)
        return "";
    else
        return d.erase (d.find_last_not_of (t) + 1) ;
}  

inline string trim_left (const string & s, const string & t = SPACES)
{
    string d (s);
    return d.erase (0, s.find_first_not_of (t)) ;
}  

inline string trim (const string & s, const string & t = SPACES)
{
    string d (s);
    return trim_left (trim_right (d, t), t) ;
}  
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}