fn main {
let str = "trest_1231";
match str {
"$(left)_$(right)" => {
println(left);
println(right);
}
_ => println("no match")
}
}
类似上面这样,用 match 匹配字符串的一部分出来
fn main {
let str = "trest_1231";
match str {
"$(left)_$(right)" => {
println(left);
println(right);
}
_ => println("no match")
}
}
类似上面这样,用 match 匹配字符串的一部分出来