strdel(3pub)

strdel3pub

Delete characters from beginning of string

Usage

#include <publib.h>
char *strdel(char *s, size_t n);

Overview

strdel removes the first n characters of s. If n is greater than the length of the string, all characters in the string (not counting '\0') are removed but no more.

Return value

strdel returns its first argument.

Examples

To change all occurrences of "Pascal" in the input to "Yuck!", you might do the following:

#include <string.h>
#include <stdio.h>
#include <publib.h>
int main(void) {
	char line[512];
	while (fgets(line, sizeof(line), stdio) != NULL) {
		while ((p = strstr(line, "Pascal")) != NULL) {
			strdel(p, 6);
			strins(p, "Yuck!");
		}
		printf("%s", line);
	}
	return 0;
}

Releases

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

  1. 1.2–1.3
  2. 2.0–2.2
  3. 3.0
  4. 3.1–6.0
  5. 7–8
  6. 9–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.