pub fn double_characters(input: &str) -> StringExpand description
Randomly doubles some characters in the string.
Each alphabetic character has approximately a 33% chance of being doubled. This creates visually distinct text that tests input normalization and character repetition handling. Non-alphabetic characters are not doubled.
§Use Cases
- Input Validation: Test if systems properly handle repeated characters
- Blue Team: Verify normalization and deduplication logic
- Red Team: Bypass simple length or pattern checks
- Data Quality: Test string comparison and matching algorithms
§Examples
use redstr::double_characters;
let result = double_characters("test");
// Example output: "teesst" or "ttest" or "tesst" (varies each run)
assert!(result.len() >= 4);
// Test input validation
let username = double_characters("admin");
// Example: "aadmiin" or "addmin" or "admmin"
// Numbers are preserved
let mixed = double_characters("test123");
// Example: "ttesst123" (numbers unchanged)