STFINV library: seek source wavelet correction filter

◆ trimws()

std::string stfinv::tools::trimws ( std::string  s)

remove leading and trailing whitespace

Parameters
sany string
Returns
value a input string with any leading and trailing whitespace removed

Definition at line 85 of file parameterhandler.cc.

Referenced by stfinv::STFBaseEngine::parseparameters().

86 {
87  if (s.length()>0)
88  {
89  std::string::size_type ib=s.find_first_not_of(" ", 0);
90  if (ib==std::string::npos)
91  {
92  s="";
93  }
94  else
95  {
96  std::string::size_type il=s.find_last_not_of(" \r", s.length());
97  std::string::size_type n=il>=ib ? il-ib+1 : 0;
98  if (n==0) { ib = 0; }
99  if ((ib!=0) || (n!=s.length())) { s=s.substr(ib,n); }
100  }
101  }
102  return(s);
103 } // std::string trimws(std::string s)
int n
Number of pairs in the array.
Definition: stfinv.h:190
Here is the caller graph for this function: