From 5717f3ba32358f8cdfd5a77e2527ebece2423e78 Mon Sep 17 00:00:00 2001 From: TimLai666 <43640816+TimLai666@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:41:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exercises/09_strings/README.md | 11 +++++------ exercises/09_strings/strings1.rs | 7 +++---- exercises/09_strings/strings2.rs | 11 +++++------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/exercises/09_strings/README.md b/exercises/09_strings/README.md index fa2104cc..496c137f 100644 --- a/exercises/09_strings/README.md +++ b/exercises/09_strings/README.md @@ -1,9 +1,8 @@ -# Strings +# 字串 -Rust has two string types, a string slice (`&str`) and an owned string (`String`). -We're not going to dictate when you should use which one, but we'll show you how -to identify and create them, as well as use them. +Rust 有兩種類型的字串:字串切片 (`&str`) 和 owned string (`String`)。 +我們不會規定您應該何時使用哪一種,但我們會向您展示如何識別和創建它們,以及如何使用它們。 -## Further information +## 更多資訊 -- [Strings](https://doc.rust-lang.org/book/ch08-02-strings.html) +- [字串](https://doc.rust-lang.org/book/ch08-02-strings.html) diff --git a/exercises/09_strings/strings1.rs b/exercises/09_strings/strings1.rs index f50e1fa9..5487b39c 100644 --- a/exercises/09_strings/strings1.rs +++ b/exercises/09_strings/strings1.rs @@ -1,15 +1,14 @@ // strings1.rs // -// Make me compile without changing the function signature! +// 使我在不改變函數簽名的情況下編譯! // -// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint strings1` 或使用 `hint` watch 子命令來獲取提示。 // I AM NOT DONE fn main() { let answer = current_favorite_color(); - println!("My current favorite color is {}", answer); + println!("我現在最喜歡的顏色是 {}", answer); } fn current_favorite_color() -> String { diff --git a/exercises/09_strings/strings2.rs b/exercises/09_strings/strings2.rs index 4d95d16a..1a28a0bd 100644 --- a/exercises/09_strings/strings2.rs +++ b/exercises/09_strings/strings2.rs @@ -1,18 +1,17 @@ // strings2.rs // -// Make me compile without changing the function signature! +// 使我在不改變函數簽名的情況下編譯! // -// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint strings2` 或使用 `hint` watch 子命令來獲取提示。 // I AM NOT DONE fn main() { - let word = String::from("green"); // Try not changing this line :) + let word = String::from("green"); // 嘗試不要更改這行 :) if is_a_color_word(word) { - println!("That is a color word I know!"); + println!("那是一個我知道的顏色字!"); } else { - println!("That is not a color word I know."); + println!("那不是一個我知道的顏色字。"); } }