Removes any whitespace padding from the end of a string
| 183 | |
| 184 | // Removes any whitespace padding from the end of a string |
| 185 | void RemoveTrailingWhitespace(char *s) { |
| 186 | int last_char_pos; |
| 187 | |
| 188 | last_char_pos = strlen(s) - 1; |
| 189 | while (last_char_pos >= 0 && isspace(s[last_char_pos])) { |
| 190 | s[last_char_pos] = '\0'; |
| 191 | last_char_pos--; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | // Returns a pointer to the first non-whitespace char in given string |
| 196 | char *SkipInitialWhitespace(char *s) { |