]> git.lyx.org Git - features.git/blobdiff - src/support/lstrings.cpp
Stop using a GCC extension for an unprintable character in regex.
[features.git] / src / support / lstrings.cpp
index b85307f5b2fe91787cd984406bd3526e05be7017..351c9775cc82a4817238ca9e89da8009bf885229 100644 (file)
@@ -975,6 +975,21 @@ int count_char(docstring const & str, docstring::value_type chr)
 }
 
 
+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();