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 is size or more, then the contents of dest are 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms