37 #define DATRW_UTIL_CC_VERSION \ 51 const double epsilon=1.e-30;
54 std::cerr <<
"DEBUG (nsignificantdigits): " 55 <<
"entered function for value:" << v << std::endl;
65 double basefactor=pow(10.,-floor(log10(v)));
69 std::cerr <<
"DEBUG (nsignificantdigits): " 70 <<
"basefactor: " << basefactor <<
" " 76 double factor=basefactor*pow(10.,n);
82 std::cerr <<
"DEBUG (nsignificantdigits): " 83 <<
"factor: " << factor <<
" " 85 <<
"v1: " << v1 <<
" " 86 <<
"v2: " << v2 <<
" " 105 std::string
clipstring(std::string& s,
const std::string& delim)
107 std::string::size_type i=s.find(delim);
109 if ((i>=0) && (i<s.length())) {
110 result=s.substr(0,i);
111 s.erase(0,i+delim.length());
123 std::replace(s.begin(), s.end(),
',',
' ');
133 std::string::size_type ib=s.find_first_not_of(
" ", 0);
134 if (ib==std::string::npos)
140 std::string::size_type il=s.find_last_not_of(
" \r", s.length());
141 std::string::size_type n=il>=ib ? il-ib+1 : 0;
142 if (n==0) { ib = 0; }
143 if ((ib!=0) || (n!=s.length())) { s=s.substr(ib,n); }
std::string commatospace(std::string s)
std::string trimws(std::string s)
remove leading and trailing whitespace
Root namespace of library.
utilities used by more than one type of data reader (prototypes)
int ntrailingdigits(double v, const bool &debug)
return number of trailing digits (after decimal point)
int nsignificantdigits(double v, const bool &debug)
return number of significant digits
std::string clipstring(std::string &s, const std::string &delim)
strip substringStrips off first substring up to given delimiter. The string is passed as a reference ...