pub fn randomize_capitalization(input: &str) -> StringExpand description
Applies random capitalization to each letter in the input string.
Each alphabetic character has a 50% chance of being uppercase or lowercase, creating unpredictable case patterns. Non-alphabetic characters (numbers, spaces, punctuation) are preserved unchanged.
§Use Cases
- Red Team: Bypass case-sensitive filters and detection systems
- Blue Team: Test case-insensitive input validation
- General: Create visually distinctive text for testing purposes
§Examples
use redstr::randomize_capitalization;
let result = randomize_capitalization("hello world");
// Example output: "HeLlO wOrLd" or "hElLo WoRLd" (varies each run)
assert_eq!(result.len(), "hello world".len());
// Numbers and symbols are preserved
let result2 = randomize_capitalization("test123");
assert!(result2.contains("123"));