Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/Reverse-a-string/Rust/reverse-a-string-1.rust
Normal file
3
Task/Reverse-a-string/Rust/reverse-a-string-1.rust
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let mut buffer = b"abcdef".to_vec();
|
||||
buffer.reverse();
|
||||
assert_eq!(buffer, b"fedcba");
|
||||
2
Task/Reverse-a-string/Rust/reverse-a-string-2.rust
Normal file
2
Task/Reverse-a-string/Rust/reverse-a-string-2.rust
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
let output: String = "一二三四五六七八九十".chars().rev().collect();
|
||||
assert_eq!(output, "十九八七六五四三二一");
|
||||
3
Task/Reverse-a-string/Rust/reverse-a-string-3.rust
Normal file
3
Task/Reverse-a-string/Rust/reverse-a-string-3.rust
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let output: String = "as⃝df̅".chars().rev().collect();
|
||||
assert_ne!(output, "f̅ds⃝a"); // should be this
|
||||
assert_eq!(output, "̅fd⃝sa");
|
||||
4
Task/Reverse-a-string/Rust/reverse-a-string-4.rust
Normal file
4
Task/Reverse-a-string/Rust/reverse-a-string-4.rust
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
let output: String = "as⃝df̅".graphemes(true).rev().collect();
|
||||
assert_eq!(output, "f̅ds⃝a");
|
||||
Loading…
Add table
Add a link
Reference in a new issue