rust 获取网址链接最后一层文件名

180it 2023-03-06 AM 341℃ 0条
fn main() {
    let location = String::from(
        "http://www.xxxx.com/archives/2017/123.html",
    );
    let pos: Vec<&str> = location.split("/").collect();
    println!("id: {}", pos[pos.len() - 1]);
}

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

rust 获取网址链接最后一层文件名