File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,12 @@ println!("The first letter of s is {}", s[0]); // エラー!!!
138
138
<!-- expensive operation, and we don’t want to be misleading. Furthermore, ‘letter’ -->
139
139
<!-- isn’t something defined in Unicode, exactly. We can choose to look at a string as -->
140
140
<!-- individual bytes, or as codepoints:-->
141
- 普通、ベクターへの ` [] ` を用いたアクセスはとても高速です。
141
+ 普通、ベクタへの ` [] ` を用いたアクセスはとても高速です。
142
142
しかし、UTF-8にエンコードされた文字列中の一つ一つの文字は複数のバイトであることが可能なため、
143
143
文字列のn番の文字を探すためには文字列上を移動していく必要があります。
144
144
そのような作業はとても高コストな演算であり、誤解してはならない点です。
145
145
さらに言えば、「文字」というものはUnicodeにおいては正確に定義されていません。
146
- 文字列を、それぞれのバイトとして見ることも、コードポインの集まりとして見ることもできるのです 。
146
+ 文字列を、それぞれのバイトとして見ることも、コードポイントの集まりとして見ることもできるのです 。
147
147
148
148
``` rust
149
149
let hachiko = " 忠犬ハチ公" ;
@@ -177,7 +177,7 @@ println!("");
177
177
178
178
``` rust
179
179
# let hachiko = " 忠犬ハチ公" ;
180
- let dog = hachiko . chars (). nth (1 ); // kinda like hachiko[1]
180
+ let dog = hachiko . chars (). nth (1 ); // hachiko[1]のような感じで
181
181
```
182
182
183
183
<!-- This emphasizes that we have to walk from the beginning of the list of `chars`. -->
You can’t perform that action at this time.
0 commit comments