strrtrim(3pub)

strrtrim3pub

Remove trailing whitespace

Usage

#include <publib.h>
char *strrtrim(char *s);

Overview

strrtrim removes all trailing whitespace characters from the end of a string. As whitespace is counted everything for which isspace(3) returns true.

Return value

strltrim returns its argument.

Examples

To remove whitespace from the 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) {
		strrtrim(line);
		printf("%s", line);
	}
	return 0;
}

Releases

16 releases since Debian 1.2 (Rex); the text changed 4 times.

  1. 1.2–1.3
  2. 2.0–2.2
  3. 3.0
  4. 3.1–6.0
  5. 7–13

Author

Lars Wirzenius ([email protected])

From publib-dev 0.40-4 in Debian 13 (Trixie). Parsed by carta from the page's man source.