DATRW++ library: seismic data I/O with multiple formats

◆ trimws()

void datrw::tsoft::trimws ( std::string &  line)

helper function trimws

Definition at line 375 of file tsoftdata.cc.

Referenced by getDOSline(), datrw::tsoft::Line::Line(), passtrimws(), and datrw::tsoft::Channelinfo::setunits().

376  {
377  // std::cout << "<" << line << ">" << std::endl;
378  if (line.length()>0)
379  {
380  // std::cout << line.length() << " > 0" << std::endl;
381  string::size_type ib=line.find_first_not_of(" ", 0);
382  if (ib==string::npos)
383  {
384  line="";
385  }
386  else
387  {
388  string::size_type il=line.find_last_not_of(" \r", line.length());
389  string::size_type n=il>=ib ? il-ib+1 : 0;
390  if (n==0) { ib = 0; }
391  /*
392  std::cout << "ib = " << ib << "; il = " << il <<
393  "; n = " << n << std::endl;
394  */
395  if ((ib!=0) || (n!=line.length())) { line=line.substr(ib,n); }
396  }
397  }
398  } // trimws(std::string& line)
Here is the caller graph for this function: