diff BEDTools-Version-2.14.3/src/utils/stringUtilities/stringUtilities.h @ 0:dfcd8b6c1bda

Uploaded
author aaronquinlan
date Thu, 03 Nov 2011 10:25:04 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BEDTools-Version-2.14.3/src/utils/stringUtilities/stringUtilities.h	Thu Nov 03 10:25:04 2011 -0400
@@ -0,0 +1,18 @@
+#ifndef STRINGUTILITIES_H
+#define STRINGUTILITIES_H
+
+#include <cctype>
+#include <string>
+
+/****************************************************
+// isInteger(s): Tests if string s is a valid integer
+*****************************************************/
+inline bool isInteger(const std::string& s) {
+    int len = s.length();
+    for (int i = 0; i < len; i++) {
+        if (!std::isdigit(s[i])) return false;
+    return true;
+}
+
+#endif /* STRINGUTILITIES_H */
+