Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,16 @@
fn main() {
let s = String::from("žluťoučký kůň");
let mut modified = s.clone();
modified.remove(0);
println!("{}", modified);
let mut modified = s.clone();
modified.pop();
println!("{}", modified);
let mut modified = s;
modified.remove(0);
modified.pop();
println!("{}", modified);
}

View file

@ -0,0 +1,28 @@
fn main() {
let s = "žluťoučký kůň";
println!(
"{}",
s.char_indices()
.nth(1)
.map(|(i, _)| &s[i..])
.unwrap_or_default()
);
println!(
"{}",
s.char_indices()
.nth_back(0)
.map(|(i, _)| &s[..i])
.unwrap_or_default()
);
println!(
"{}",
s.char_indices()
.nth(1)
.and_then(|(i, _)| s.char_indices().nth_back(0).map(|(j, _)| i..j))
.map(|range| &s[range])
.unwrap_or_default()
);
}