pub fn reverse_string(input: &str) -> StringExpand description
Reverses the input string.
Reverses the order of all characters in the string. This is a simple transformation that can be used for basic obfuscation or testing palindrome detection. Works correctly with Unicode characters.
§Use Cases
- Basic Obfuscation: Simple reversible transformation
- Testing: Verify string reversal implementations
- Palindromes: Test palindrome detection logic
- Data Encoding: Combine with other transformations for layered encoding
§Examples
use redstr::reverse_string;
assert_eq!(reverse_string("hello"), "olleh");
assert_eq!(reverse_string("test123"), "321tset");
// Reversing twice returns the original
let text = "example";
assert_eq!(reverse_string(&reverse_string(text)), text);
// Works with Unicode
assert_eq!(reverse_string("café"), "éfac");