+/**
+ * \ingroup Globals
+ * \brief Because not available in C++ (?)
+ * Counts the number of occurences of a substring within a string
+ */
+
+ int CountSubstring (const std::string& str,
+ const std::string& subStr) {
+ int count = 0; // counts how many times it appears
+ unsigned int x = 0; // The index position in the string
+
+ do
+ { x = str.find(subStr,x); // Find the substring
+ if (x != std::string::npos) // If present
+ { count++; // increase the count
+ x += subStr.length(); // Skip this word
+ }
+ }
+ while (x != std::string::npos); // Carry on until not present
+
+ return count;
+}
+