What do you want to save?
Add Code snippet
New code examples in category Rust
-
-
Cyker 2021-10-25 07:54:13
Validate the check digit of an ISBN-13 code
/* Validate the check digit of an ISBN-13 code: Multiply every other digit by 3. Add the digits together. Take the remainder of division by 10. If it is 0, the ISBN-13 check digit is correct. from RosettaCode */ fn check_isbn(isbn: &str) ... Add solution -
Trevor P. Dutt 2021-10-21 12:03:06
how to split a string by spaces rust
let mut iter = "A few words".split_whitespace(); assert_eq!(Some("A"), iter.next()); assert_eq!(Some("few"), iter.next()); assert_eq!(Some("words"), iter.next()); assert_eq!(None, iter.next()); Add solution -
Siegfried Zaytsev 2021-10-19 14:28:05
get the temp directory rust
std::env::temp_dir(); Add solution -
-
Redpenner 2021-10-17 23:59:10
split text on multiple separators and put into a list
use regex::Regex; fn main() { // split text on multiple separators and put into a list let q = "The quick brown fox jumps over the lazy dog's back"; let separator = Regex::new(r"([ ,.]+)").expect("Invalid regex"... Add solution