Skip to content

Strings practice problems in Rust

Difficulty:
Category & tags Filters active
Category:
Tag:

Showing 27 of 27

Title Difficulty
ASCII search without lowercase copies Easy
Borrow it or own it: your first lifetime decision Easy
Build a CSV record with one output buffer Easy
Build a report with a reusable string buffer Medium
Build FizzBuzz strings with an if expression Easy
collect and the turbofish: three targets, one source Medium
Cow: borrow until you have to own Medium
Cow in API design: impl Into<Cow<str>> Hard
flat_map: expand a range spec like "1-3,7,10-12" Medium
Giving ownership back Medium
Group anagrams with a map Medium
iter, iter_mut, into_iter: all three, one Vec Easy
Joining owned strings Easy
Move or borrow: the two ways to pass a value Easy
Move semantics: the relay Easy
? on Option, and bridging to Result Medium
peekable and next_if: write a tokeniser Hard
Shadowing: rebinding is not mutation Easy
Slices are borrows Easy
Split a message at its first blank line Easy
String vs &str, part 2: functions that take and return text Medium
&str not &String, &[T] not &Vec<T>: deref coercion and ptr_arg Easy
The three rules of ownership Easy
Two inputs, one output lifetime Medium
Use lifetime elision for borrowed string results Easy
UTF-8 strings: bytes, scalar values and slicing Hard
Zero-copy parsing: borrow, don't allocate Medium