diff --git a/src/stringManipulation.c b/src/stringManipulation.c index 37c9f89..84eea0a 100644 --- a/src/stringManipulation.c +++ b/src/stringManipulation.c @@ -67,17 +67,33 @@ unsigned int power(unsigned int base, unsigned int exponent){ } } +bool everyCharacterIsDigit(char *string) +{ + bool onlyDigits = true; + for(int i=0;*(string+i)!='\0';++i){ + if(*(string+i)<'0'||*(string+i)>'9'){ + onlyDigits = false; + break; + } + } + return onlyDigits; +} + + unsigned int toUnsignedInteger(char *ID) { + if(everyCharacterIsDigit(ID)){ unsigned int result = 0; int IDLength = strlen(ID); for(int i=0, j = IDLength - 1;i #include #include -#include +#include char *stringConcatenation(char *, char *); char *to_string(int); char *generateCheckString(unsigned int, char *); unsigned int toUnsignedInteger(char *); unsigned int power(unsigned int, unsigned int); +bool everyCharacterIsDigit(char *);