Merge branch 'master' of http://gitea.yulinling.asia/rsgl/rust-test
This commit is contained in:
commit
21970c04d5
7
string_test/Cargo.lock
generated
Normal file
7
string_test/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "string_test"
|
||||
version = "0.1.0"
|
||||
6
string_test/Cargo.toml
Normal file
6
string_test/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "string_test"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
18
string_test/src/main.rs
Normal file
18
string_test/src/main.rs
Normal file
@ -0,0 +1,18 @@
|
||||
/* 填空并修复所有错误 */
|
||||
fn main() {
|
||||
let raw_str = "Escapes don't work here: \x3F \u{211D}";
|
||||
// 修改上面的行让代码工作
|
||||
assert_eq!(raw_str, "Escapes don't work here: ? ℝ");
|
||||
|
||||
// 如果你希望在字符串中使用双引号,可以使用以下形式
|
||||
let quotes = r#"And then I said: "There is no escape!""#;
|
||||
println!("{}", quotes);
|
||||
|
||||
// 如果希望在字符串中使用 # 号,可以如下使用:
|
||||
let delimiter = r###"A string with "# in it. And even "##!"###;
|
||||
println!("{}", delimiter);
|
||||
|
||||
// 填空
|
||||
let long_delimiter = "Hello, \"##\"";
|
||||
assert_eq!(long_delimiter, "Hello, \"##\"")
|
||||
}
|
||||
Reference in New Issue
Block a user