Replace deprecated string method for Rust.