From daa595a3227ac1c84f87ec8732ac1f081e8b6bea Mon Sep 17 00:00:00 2001 From: TheUltimateOptimist Date: Sun, 28 Jan 2024 00:33:43 +0100 Subject: [PATCH] implemented trimLeft --- src/userinput.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/userinput.c b/src/userinput.c index 863c005..bd343e9 100644 --- a/src/userinput.c +++ b/src/userinput.c @@ -1 +1,15 @@ -#include "userinput.h" \ No newline at end of file +#include "userinput.h" + +#include +#include + +void trimLeft(char *input) { + size_t length = strlen(input); + int firstIndex = 0; + while (firstIndex < length && isspace(input[firstIndex])) { + firstIndex++; + } + for (int i = 0; i <= length - firstIndex; i++) { + input[i] = input[firstIndex + i]; + } +} \ No newline at end of file