Function decancer::cure

source ·
pub fn cure(input: &str) -> Result<CuredString, Error>
Expand description

Cures a string.

Output will always be in lowercase and it will be bidirectionally reordered in order to treat right-to-left characters. Therefore, the output of this function should not be displayed visually.

§Errors

Errors if the string is malformed to the point where it’s not possible to apply unicode’s bidirectional algorithm to it.

§Examples

Basic usage:

let cured = decancer::cure("vEⓡ𝔂 𝔽𝕌Ňℕy ţ乇𝕏𝓣").unwrap();

assert_eq!(cured, "very funny text");
assert!(cured.contains("FuNny"));
assert_eq!(cured.into_str(), String::from("very funny text"));