STRDEL(3pub)
π STRDEL(3pub) π
okay bestie, welcome to the strdel page from the C Programmer's Manual (section 3pub, publib girlies rise) β it's giving "snip the front off a string" and honestly? iconic. βοΈβ¨
πΈ NAME πΈ
strdel β delete characters from beginning of string π¦
β¨ SYNOPSIS β¨
#include <publib.h>
char *strdel(char *s, size_t n);
π DESCRIPTION π
so basically, strdel removes the first n characters of s. that's it. that's the whole job. she's a simple queen. π
and if n is bigger than the length of the string? no cap, it removes all the characters in the string β but like, not counting '\0' β and no more than that. it does not go off the end and start deleting random memory, she is way too classy for that. π
π«Ά RETURN VALUE π«Ά
strdel returns its first argument. just hands it right back to you. main character behavior, honestly. π
π EXAMPLE π
say you wanna change all occurrences of "Pascal" in the input to "Yuck!" β relatable, honestly β 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;
}
π SEE ALSO π
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) β the legend himself π
and that's the whole page, bestie!! this was Publib's C Programmer's Manual, STRDEL(3pub) β go forth and delete those leading characters fr fr π¦β¨π
π¦ where this page comes from
- debian bookworm: publib-dev 0.40-3+b1 Β· BSD-2-Clause
- debian trixie: publib-dev 0.40-4 Β· BSD-2-Clause
- ubuntu jammy: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu noble: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu questing: publib-dev 0.40-4
- ubuntu resolute: publib-dev 0.40-4build1 Β· BSD-2-Clause
- ubuntu stonking: publib-dev 0.40-4build1 Β· BSD-2-Clause
- Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms