STRXFRM(3)

๐Ÿ“ฆ
version 15.1 ยท 2 versions
, in freebsd 15.1

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