mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 15:28:40 +08:00
parent
e617db71c4
commit
d027cbbbbe
@ -142,7 +142,7 @@ let s3 = String::from("toe");
|
|||||||
let s = s1 + "-" + &s2 + "-" + &s3;
|
let s = s1 + "-" + &s2 + "-" + &s3;
|
||||||
```
|
```
|
||||||
|
|
||||||
这时 `s` 的内容会是 `tic-tac-toe`。在有这么多 `+` 和 `"` 字符的情况下,很难理解具体发生了什么。对于更为复杂的字符串链接,可以使用 `format!` 宏:
|
这时 `s` 的内容会是 `tic-tac-toe`。在有这么多 `+` 和 `"` 字符的情况下,很难理解具体发生了什么。对于更为复杂的字符串连接,可以使用 `format!` 宏:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let s1 = String::from("tic");
|
let s1 = String::from("tic");
|
||||||
|
Loading…
Reference in New Issue
Block a user