範例4-7:函式 first_word 回傳參數 String 第一個單字最後的索引. 因為我們需要遍歷 String ... 幸運的是Rust 為此提供了一個解決辦法:字串切片(String slice)。
確定! 回上一頁