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

◆ clipstring()

std::string datrw::util::clipstring ( std::string &  s,
const std::string &  delim = ":" 
)

strip substringStrips off first substring up to given delimiter. The string is passed as a reference and will be modified (i.e. the stripped substring as well as the delimiter will be erased).

Parameters
sinput string
delimdelimiter to look for
Returns
first part of string up to delimiter
Examples:
libdatrwxxtests.cc.

Definition at line 105 of file util.cc.

Referenced by datrw::anyID(), main(), datrw::formatmodifiers::makeparamap(), datrw::oanystream::open(), datrw::ianystream::open(), and datrw::iasciistream::readheader().

106  {
107  std::string::size_type i=s.find(delim);
108  std::string result;
109  if ((i>=0) && (i<s.length())) {
110  result=s.substr(0,i);
111  s.erase(0,i+delim.length());
112  } else {
113  result=s;
114  s.erase();
115  }
116  return(result);
117  } // std::string clipstring
Here is the caller graph for this function: