Browse Source

implemented trimRight

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

9
src/userinput.c

@ -12,4 +12,13 @@ void trimLeft(char *input) {
for (int i = 0; i <= length - 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