Update src/basic/compound-type/string-slice.md

pull/927/head
Sunface 2 years ago committed by GitHub
parent 091e57a38b
commit a7124948fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,7 +99,7 @@ let slice = &s[..];
字符串切片的类型标识是 `&str`,因此我们可以这样声明一个函数,输入 `String` 类型,返回它的切片: `fn first_word(s: &String) -> &str `
有了切片就可以写出这样的不安全代码:
有了切片就可以写出这样的代码:
```rust
fn main() {

Loading…
Cancel
Save