String Reverser
Advanced text reversal tool featuring Unicode-safe algorithms, word/line inversion modes, pseudo-mirror text generation, and instant palindrome detection.
About
Standard string reversal is a computationally trivial task often implemented incorrectly. Most basic tools rely on naive splitting methods (e.g., str.split('')) which fail catastrophically when encountering surrogate pairs found in Emojis (e.g., 🌮) or complex grapheme clusters (e.g., Z͍). This destroys the character encoding, resulting in garbage output.
This tool utilizes the ECMAScript Internationalization API and iterator protocols to correctly segment strings by grapheme, ensuring that multi-byte characters, emojis, and combining diacritics remain intact during reversal. It is designed for developers debugging data streams, linguists analyzing patterns, and creative users generating stylized text.
Formulas
The naive approach to string reversal uses basic array splitting:
This fails for surrogate pairs. The correct approach uses the iterator protocol or Intl.Segmenter to respect grapheme boundaries:
For Mirror Text generation, we map characters to their unicode antipodes:
Reference Data
| Mode | Input Example | Output Example | Use Case |
|---|---|---|---|
| Standard Reverse | Hello 🚀 | 🚀 olleH | Cryptography, debugging, puzzles |
| Reverse Words | System Critical Error | Error Critical System | Sentence restructuring, yoda-speak |
| Reverse Lines | 1. Alpha 2. Beta | 2. Beta 1. Alpha | Log file analysis, list reordering |
| Mirror (Pseudo) | text | ʇəxʇ | Creative design, social media styling |
| Palindrome | Racecar | TRUE | Algorithm verification, leisure |
| Grapheme Count | 👨👩👧 (Family) | 1 Unit | Data validation, length checks |