Skip to content

v0.2.49..v0.2.50 changeset StringUtils.h

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/util/StringUtils.h b/hoot-core/src/main/cpp/hoot/core/util/StringUtils.h
index 0f46295..f47799e 100644
--- a/hoot-core/src/main/cpp/hoot/core/util/StringUtils.h
+++ b/hoot-core/src/main/cpp/hoot/core/util/StringUtils.h
@@ -30,6 +30,7 @@
 
 // Qt
 #include <QStringList>
+#include <QSet>
 
 // Boost
 #include <boost/property_tree/json_parser.hpp>
@@ -52,7 +53,7 @@ public:
    * @param durationInMilliseconds seconds to convert
    * @return a DD:MM:SS string
    */
-  static QString secondsToDhms(const qint64 durationInMilliseconds);
+  static QString millisecondsToDhms(const qint64 durationInMilliseconds);
 
   /**
    * Converts a large number to a more human readable format
@@ -119,6 +120,31 @@ public:
    * @param strings the strings to modify
    */
   static void removeEmptyStrings(QStringList& strings);
+
+  /**
+   * Determines if a string is made up of entirely alphanumeric characters
+   *
+   * @param input string to examine
+   * @return true if the string contains only alphanumeric characters; false otherwise
+   */
+  static bool isAlphaNumeric(const QString& input);
+
+  /**
+   * Finds duplicate strings in a list
+   *
+   * @param input the list to search
+   * @return a collection of duplicated strings
+   */
+  static QSet<QString> getDuplicates(const QStringList& input);
+
+  /**
+   * Determines whether any string in a list of strings contains a substring
+   *
+   * @param input a list of strings to examine
+   * @param substring the substring to search for
+   * @return true if any string in the input list contains the given substring; false otherwise
+   */
+  static bool containsSubstring(const QStringList& input, const QString& substring);
 };
 
 }
Clone this wiki locally