simple function to check if entire buffer is purely numbers
authorMatt <matt@uncensored.citadel.org>
Sun, 14 Dec 2008 11:59:51 +0000 (11:59 +0000)
committerMatt <matt@uncensored.citadel.org>
Sun, 14 Dec 2008 11:59:51 +0000 (11:59 +0000)
libcitadel/lib/stringbuf.c

index 03632033602ac168d5885644b067159671735ca2..db6a3b12b7a5c5cb90009813a48715afb7611ada 100644 (file)
@@ -291,7 +291,14 @@ int StrToi(const StrBuf *Buf)
        else
                return 0;
 }
-
+/**
+ * \brief Checks to see if the string is a pure number 
+ */
+int StrBufIsNumber(const StrBuf *Buf) {
+  char * pEnd;
+  strtoll(Buf->buf, &pEnd, 10);
+  return (strlen(pEnd) > 0) ? 0 : 1;
+} 
 /**
  * \brief modifies a Single char of the Buf
  * You can point to it via char* or a zero-based integer