From 4fc194b8ff598ecae95ff3663ceaa6d21d66b014 Mon Sep 17 00:00:00 2001 From: kscale <50147430+kscale@users.noreply.github.com> Date: Wed, 19 Jan 2022 16:03:54 +0800 Subject: [PATCH] Update string-slice.md --- book/contents/basic/compound-type/string-slice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/contents/basic/compound-type/string-slice.md b/book/contents/basic/compound-type/string-slice.md index 3657440f..45e0125b 100644 --- a/book/contents/basic/compound-type/string-slice.md +++ b/book/contents/basic/compound-type/string-slice.md @@ -81,7 +81,7 @@ let slice = &s[0..len]; let slice = &s[..]; ``` ->在对字符串使用切片语法时需要格外小心,切片的索引必须落在字符之间的边界位置,也就是UTF8字符的边界,例如中文在UT8中占用三个字节,下面的代码就会崩溃: +>在对字符串使用切片语法时需要格外小心,切片的索引必须落在字符之间的边界位置,也就是UTF8字符的边界,例如中文在UTF8中占用三个字节,下面的代码就会崩溃: >```rust > let s = "中国人"; > let a = &s[0..2];