strtrim3pub
Remove leading and trailing whitespace
Usage
#include <publib.h> char *strtrim(char *s);
Overview
strtrim removes all whitespace characters from the beginning and the end of a string. As whitespace is counted everything for which isspace(3) returns true.
Return value
strtrim returns its argument.
Examples
To remove whitespace from the beginning and end of all lines, you might do the following:
#include <publib.h>
int main(void) {
char line[512];
while (fgets(line, sizeof(line), stdio) != NULL) {
strtrim(line);
printf("%s", line);
}
return 0;
}
Releases
16 releases since Debian 1.2 (Rex); the text changed 4 times.