long StrTol(const StrBuf *Buf);
int StrToi(const StrBuf *Buf);
+int StrBufIsNumber(const StrBuf *Buf);
long StrBuf_Utf8StrLen(StrBuf *Buf);
long StrBuf_Utf8StrCut(StrBuf *Buf, int maxlen);
struct StrBuf {
char *buf; /**< the pointer to the dynamic buffer */
long BufSize; /**< how many spcae do we optain */
- long BufUsed; /**< Number of Chars used excluding the trailing \0 */
+ long BufUsed; /**< StNumber of Chars used excluding the trailing \0 */
int ConstBuf; /**< are we just a wrapper arround a static buffer and musn't we be changed? */
};
* \brief Checks to see if the string is a pure number
*/
int StrBufIsNumber(const StrBuf *Buf) {
+ if (Buf == NULL) {
+ return 0;
+ }
char * pEnd;
strtoll(Buf->buf, &pEnd, 10);
- return (strlen(pEnd) > 0) ? 0 : 1;
+ if (pEnd != NULL && ((Buf->buf)-pEnd) == 0) {
+ return 0;
+ }
+ return 1;
}
/**
* \brief modifies a Single char of the Buf