Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strtrim(3pub) [debian man page]

STRTRIM(3pub)						       C Programmer's Manual						     STRTRIM(3pub)

NAME
strtrim - remove leading and trailing whitespace SYNOPSIS
#include <publib.h> char *strtrim(char *s); DESCRIPTION
strtrim removes all whitespace characters from the beginning and the end of a string. As whitespace is counted everything for which iss- pace(3) returns true. RETURN VALUE
strtrim returns its argument. EXAMPLE
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; } SEE ALSO
publib(3), strrtrim(3), strltrim(3), isspace(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STRTRIM(3pub)

Check Out this Related Man Page

STRSUB(3pub)						       C Programmer's Manual						      STRSUB(3pub)

NAME
strsub - substitute first occurence of pattern with another string SYNOPSIS
#include <publib.h> char *strsub(char *str, const char *pat, const char *sub); DESCRIPTION
strsub finds the first occurence of the pattern pat in the string str (using a method similar to strstr(3), i.e., no regular expressions), and replaces it with sub. If pat does not occur in str, no substitution is made. Of course, if sub is an empty string, the pattern is deleted from the string. RETURN VALUE
strsub returns a pointer to the first character after the substitution, or NULL if no substitution was made. EXAMPLE
To substitute up to two occurences of "foo" with "bar" in a line, one might do the following. p = strsub(line, "foo", "bar"); if (p != NULL) strsub(line, "foo", "bar"); SEE ALSO
publib(3), strstr(3), strgsub(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STRSUB(3pub)
Man Page