STRXFRM(3)
๐ STRXFRM(3) โ transform a string under locale ๐
okay bestie, this is the Library Functions Manual entry for strxfrm, and itโs literally the glow-up your string needs before collation comparisons. โจ
๐ NAME ๐
strxfrm โ transform a string under locale
๐ LIBRARY ๐
Standard C Library (libc, -lc) โ yes, the classic. ๐ซถ
๐ง SYNOPSIS ๐ง
#include <string.h>
size_t
strxfrm(char * restrict dst, const char * restrict src, size_t n);
size_t
strxfrm_l(char * restrict dst, const char *restrict src, size_t n,
locale_t loc);
๐ DESCRIPTION ๐
So strxfrm() takes the null-terminated string pointed to by src, transforms it according to the current locale collation if any, and then copies the transformed string into dst. โจ
Not more than n characters are copied into dst, including the terminating null character added. If n is set to 0 (it helps to determine an actual size needed for transformation), dst is permitted to be a NULL pointer. No cap, thatโs the size-probe era. ๐
Comparing two strings using strcmp() after strxfrm() is equal to comparing two original strings with strcoll(). Like, same energy, different route. ๐ซ
strxfrm_l() does the same, however takes an explicit locale rather than the global locale. Main character move: you pick the locale yourself. ๐
๐ฅ RETURN VALUES ๐ฅ
Upon successful completion, strxfrm() and strxfrm_l() return the length of the transformed string not including the terminating null character. ๐
๐จ If this value isnor more, the contents ofdstare indeterminate. Thatโs the danger zone, bestie โ do not trust those bytes, fr fr. ๐
๐ SEE ALSO ๐
๐ STANDARDS ๐
- The
strxfrm()function conforms to ISO/IEC 9899:1990 (โISO C90โ). โญ - The
strxfrm_l()function conforms to IEEE Std 1003.1-2008 (โPOSIX.1โ). ๐ธ
๐ source/version vibes: Debian, dated June 4, 1993 โ talk soon, bestie ๐ซถ
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1990, 1991, 1993 The Regents of the University of California. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms