}
+docstring capitalize(docstring const & s) {
+ docstring ret = s;
+ char_type t = uppercase(ret[0]);
+ ret[0] = t;
+ return ret;
+}
+
+
string const ascii_lowercase(string const & a)
{
string tmp(a);
}
+int wordCount(docstring const & d)
+{
+ docstring dt = trim(d);
+ if (dt.empty())
+ return 0;
+ int words = 1;
+ for (auto const & c : dt) {
+ if (isSpace(c))
+ words++;
+ }
+ return words;
+}
+
+
+
int count_bin_chars(string const & str)
{
QString const qstr = toqstr(str).simplified();
os << std::fixed;
// Prevent outputs of 23.4200000000000017 but output small numbers
// with at least 6 significant digits.
- double const logarithm = log10(fabs(x));
- os << std::setprecision(max(6 - iround(logarithm), 0)) << x;
+ int const precision = (x == 0.0) ? 0 : max(6 - iround(log10(fabs(x))), 0);
+ os << std::setprecision(precision) << x;
string result = os.str();
if (result.find('.') != string::npos) {
result = rtrim(result, "0");