add solutions for string.md

This commit is contained in:
sunface
2022-03-02 20:57:13 +08:00
parent 2d7e251e8b
commit 0f4685dcf0
6 changed files with 355 additions and 34 deletions

View File

@@ -14,7 +14,7 @@ fn main() {
```
🌟🌟🌟 如果要使用 `str` 类型,只能配合 `Box`。 `&` 可以用来将 `Box<str>` 转换为 `&str` 类型
🌟🌟 如果要使用 `str` 类型,只能配合 `Box`。 `&` 可以用来将 `Box<str>` 转换为 `&str` 类型
```rust,editable
@@ -51,7 +51,7 @@ fn main() {
// 修复所有错误,并且不要新增代码行
fn main() {
let s = String::from("hello");
s.push(',');`
s.push(',');
s.push(" world");
s += "!".to_string();
@@ -79,7 +79,7 @@ fn main() {
```rust,editable
// 修复所有错误
// 修复所有错误,不要删除任何一行代码
fn main() {
let s1 = String::from("hello,");
let s2 = String::from("world!");