From 02481656966b0a8dfc95cf3c22bcc049660ff7d4 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sat, 26 Dec 2020 17:48:38 +0000 Subject: Move Rust exercises in a subdirectory --- rust/reverse-string/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 rust/reverse-string/src/lib.rs (limited to 'rust/reverse-string/src') diff --git a/rust/reverse-string/src/lib.rs b/rust/reverse-string/src/lib.rs new file mode 100644 index 0000000..f488a6e --- /dev/null +++ b/rust/reverse-string/src/lib.rs @@ -0,0 +1,5 @@ +use unicode_segmentation::UnicodeSegmentation; + +pub fn reverse(input: &str) -> String { + UnicodeSegmentation::graphemes(input, true).rev().collect() +} -- cgit v1.2.3