mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-08-11 22:14:47 +00:00
add solutions for string.md
This commit is contained in:
@@ -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!");
|
||||
|
Reference in New Issue
Block a user