The bistring library provides non-destructive versions of common string processing operations like normalization, case folding, and find/replace. Each bistring remembers the original string, and how its substrings map to substrings of the modified version.
;let s = "𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐, 𝖇𝖗𝖔𝖜𝖓 🦊 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 🐶";s = s; // Unicode normalizations = s; // Case-insensitivitys = s; // Replace emoji with texts = s;s = s; // Strip everything but letters and spacess = s; // Extract a substringconsole; // The modified substring, after changes// the quick brown foxconsole;// 𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐, 𝖇𝖗𝖔𝖜𝖓 🦊
This allows you to perform very aggressive text processing completely invisibly.
Click here for a live demo of the bistring library in your browser.