9 lines
229 B
Rust
9 lines
229 B
Rust
use unicode_segmentation::UnicodeSegmentation;
|
|
|
|
pub fn reverse(input: &str) -> String {
|
|
if cfg!(feature = "grapheme") {
|
|
input.graphemes(true).rev().collect()
|
|
} else {
|
|
input.chars().rev().collect()
|
|
}
|
|
}
|