strxfrm(3)
โจ strxfrm โ string transform โจ
okay bestie, welcome to the strxfrm page, this is a strxfrm(3) moment and honestly it's lowkey underrated ๐
it lives in the Standard C library (libc, -lc) btw, so she's built in, no extra install needed ๐ซถ
๐ธ SYNOPSIS ๐ธ
#include <string.h>
size_t strxfrm(size_t size;
char dest[restrict size], const char src[restrict size],
size_t size);
yes okay, the size parameter shows up twice in there, that's not a typo, that's just how the man page writes it, don't come for me ๐ญ
๐ฆ DESCRIPTION ๐ฆ
so here's the vibe: strxfrm() takes your src string and transforms it into a form that is genuinely iconic for one specific reason โ if you take two strings, run both of them through strxfrm(), and then compare the results with strcmp(3), you get the exact same answer you'd get by running strcoll(3) on the two strings before you transformed them. no cap. that's the whole point.
the first size bytes of the transformed string get placed in dest. ๐ซ
and the transformation itself? it's based on the program's current locale for the category LC_COLLATE ๐ (go peek at setlocale(3) if you wanna know more about that).
๐ RETURN VALUE ๐
strxfrm() returns the number of bytes you'd need to store the transformed string in dest, and that count does not include the terminating null byte ('\0') ๐
โ ๏ธ okay important warning bestie, listen: if the value returned issizeor more, then the contents ofdestare indeterminate. like, genuinely unknown. do not trust them. do not pass go. ๐
๐ง ATTRIBUTES ๐ง
for the explanation of the terms used in this section, go see attributes(7) โจ
- Interface:
strxfrm() - Attribute: Thread safety
- Value:
MT-Safe locale
โญ STANDARDS โญ
C11, POSIX.1-2008. periodt ๐
๐ HISTORY ๐
POSIX.1-2001, C89, SVr4, 4.3BSD. she's been around, she's a legacy icon, we respect her ๐ซถ
๐ SEE ALSO ๐
and that's the whole page!! ๐ this was Linux man-pages 6.20, dated 2026-08-10, and the page is strxfrm(3) โ go forth and sort your strings correctly, mwah ๐๐ฆ๐ธ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms