MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RemoveTrailingWhitespace

Function RemoveTrailingWhitespace

scripts/LEVEL15.cpp:1522–1530  ·  view source on GitHub ↗

Removes any whitespace padding from the end of a string

Source from the content-addressed store, hash-verified

1520
1521// Removes any whitespace padding from the end of a string
1522void RemoveTrailingWhitespace(char *s) {
1523 int last_char_pos;
1524
1525 last_char_pos = strlen(s) - 1;
1526 while (last_char_pos >= 0 && isspace(s[last_char_pos])) {
1527 s[last_char_pos] = '\0';
1528 last_char_pos--;
1529 }
1530}
1531
1532// Returns a pointer to the first non-whitespace char in given string
1533char *SkipInitialWhitespace(char *s) {

Callers 1

ReadMessageFileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected