Browse Source

implemented trimRight

remotes/origin/userinput
TheUltimateOptimist 11 months ago
parent
commit
e4fdad7ce3
  1. 9
      src/userinput.c

9
src/userinput.c

@ -13,3 +13,12 @@ void trimLeft(char *input) {
input[i] = input[firstIndex + i]; input[i] = input[firstIndex + i];
} }
} }
void trimRight(char *input) {
size_t length = strlen(input);
int index = length - 1;
while (index >= 0 && isspace(input[index])) {
input[index] = '\0';
index--;
}
}
Loading…
Cancel
Save