STRANAXFRM(3pub)
β¨ STRANAXFRM β¨ (that's stranaxfrm from section 3pub of the C Programmer's Manual, bestie π)
πΈ NAME πΈ
stranaxfrm β the glow-up function that turns a string into its canonical form so you can do anagram comparisons ππ¦
π SYNOPSIS π
#include <publib.h>
char *stranaxfrm(char *str);
π DESCRIPTION π
okay so. stranaxfrm takes a string and transforms it into a canonical form for anagram comparisons. that's the whole vibe. β¨
want to know if two strings are anagrams of each other? (iykyk: same characters, just shuffled around, different order, chaos.) then you literally just compare their canonical forms. that's it. that's the trick. π
and what is the canonical form, you ask? it's the string with all its characters sorted into ascending order. periodt. π
so say you want to write a program that finds anagrams. here's the main character plan:
- convert a word list into canonical order first π
- then look up words in that version of the word list, by transforming each word you're checking into canonical order too
boom. matching canonical forms = anagrams. slay. π₯
π RETURN VALUE π
stranaxfrm returns its argument. yes, the same pointer you handed it. it just hands it right back. π«Ά
π BUGS π
This function is of a whimsical nature. π
that's it. that's the bug report. it's silly on purpose, bestie. no cap.
π SEE ALSO π
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) π
okay that's the whole page, bestie, you ate it πβ¨ this was STRANAXFRM(3pub) from the Publib C Programmer's Manual β mwah, go sort some characters π
π¦π
π¦ 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