mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
add "3, 4" answers with Spaces for Q3 of type-conversions/others
add `.map(|x| x.trim())` for Q3 of type-conversions/others Added "3, 4" answers with Spaces
This commit is contained in:
@ -60,6 +60,7 @@ impl FromStr for Point {
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
|
||||
.split(',')
|
||||
.map(|x| x.trim())
|
||||
.collect();
|
||||
|
||||
let x_fromstr = coords[0].parse::<i32>()?;
|
||||
|
Reference in New Issue
Block a user