Me, every time I try searching a Rust question.
That’s easy. Just do:
fn is_second_num_positive() -> bool {
let input = "123,-45";
let is_positive =
input.split(',')
.collect::<Vec<&str>>()
.last()
.unwrap()
.parse::<i32>()
.unwrap()
.is_positive();
is_positive
}
Hank Green actually posted a video relevant to this yesterday. He was reading a Fox News article about a machine that can turn C02 into fuel that an internal combustion engine can use.
He then scrolled to the comments and saw all the posts talking about climate change being a hoax. He says it would be very easy to assume the average Fox News reader is a climate change denier. If you were to ask him how many people in the US deny climate change is real, he’d guess around 50%. However, surveys have consistently shown it is less than 10%. It is a minority of people. His point was that people leaving stupid comments are not the average person, they’re just really vocal, and try not to assume stupid comments are reflective of the average person’s beliefs.