From af62069f27f28ef94c961613a68b10aee51f384b Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sat, 4 Feb 2023 12:45:20 +0100 Subject: [PATCH] Implementation of function isLetterOfAlphabet(). --- src/stringManipulation.c | 10 ++++++++++ src/stringManipulation.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/stringManipulation.c b/src/stringManipulation.c index 84eea0a..09ebda7 100644 --- a/src/stringManipulation.c +++ b/src/stringManipulation.c @@ -79,6 +79,16 @@ bool everyCharacterIsDigit(char *string) return onlyDigits; } +bool isLetterOfAlphabet(char *string){ + bool r = true; + for(int i=0;*(string+i)!='\0';++i){ + if( !(*(string+i)>=65&&*(string+i)<=90) && !(*(string+i)>=97&&*(string+i)<=122)){ + r = false; + break; + } + } + return r; +} unsigned int toUnsignedInteger(char *ID) { diff --git a/src/stringManipulation.h b/src/stringManipulation.h index 38cf8aa..13bd217 100644 --- a/src/stringManipulation.h +++ b/src/stringManipulation.h @@ -10,4 +10,5 @@ char *generateCheckString(unsigned int, char *); unsigned int toUnsignedInteger(char *); unsigned int power(unsigned int, unsigned int); bool everyCharacterIsDigit(char *); +bool isLetterOfAlphabet(char *); #endif