STRRIGHT(3pub)
π STRRIGHT(3pub) π
okay bestie, welcome to the C Programmer's Manual β¨ this is a page from publib, and today we're talking about strright β she's a tiny little string helper and honestly? she's giving β¨effortlessβ¨
πΈ NAME πΈ
strright β return a pointer to the beginning of the rightmost n chars in a string π
β¨ SYNOPSIS β¨
#include <publib.h>
char *strright(const char *s, size_t n);
like, that's it. two lines. she's low maintenance π
π¦ DESCRIPTION π¦
so strright hands you back a pointer to the first of the n rightmost characters in the string s β and no, bestie, the '\0' does not count, she's not invited to that party π
and here's the part that makes her kind of iconic: she does not make a copy of the string. not even a little one. she just returns a pointer into the argument string. same memory, same vibes, zero duplication π
so like, if s changes, your pointer is pointing at the live thing, not a snapshot. no cap. that's the whole function. short queen π
π SEE ALSO π
publib(3)β the whole fam π«Ά
π AUTHOR π
Lars Wirzenius</purl> β wait no, Lars Wirzenius (lars.wirzenius@helsinki.fi) wrote this one and we thank him for his service πβ¨
π reminder bestie: this is publib, so if you're out here expecting this exact function in glibc, check yourself before you wreck yourself. iykyk.
and that's the page!! this one shipped as part of Publib, in the C Programmer's Manual, filed under STRRIGHT(3pub) β mwah, go forth and point at the right side of your strings responsibly πΈπ π¦
π¦ 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