TF++, Miscellaneous classes and modules in C++:

◆ trimws_end()

std::string tfxx::string::trimws_end ( std::string  s)

function #tf::trimws_end#: Erase trailing whitespace from a string.

Returns
string with trailing whitespace removed
Parameters
sstring to remove trailing whitespace from
Author
Thomas Forbriger
Version
V1.0 (#$Revision: 1.4 $
Date
2009-11-11 12:34:04

#) remove trailing whitespace

See also
trimws_begin
trimws

Definition at line 101 of file stringfunc.cc.

102  {
103  if (s.length()>0)
104  {
105  std::string::size_type il=s.find_last_not_of(" \r", s.length());
106  std::string::size_type n=il>=0 ? il+1 : 0;
107  if (n!=s.length()) { s=s.substr(0,n); }
108  }
109  return(s);
110  } // std::string trimws_end(std::string s)