Skip to content

Commit 1c9c327

Browse files
committed
tutorial: Remove the section on strings
It's already covered in the types section.
1 parent 69b363e commit 1c9c327

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

doc/tutorial.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,32 +1214,6 @@ let your_crayons = ~[banana_mania, beaver, bittersweet];
12141214
my_crayons += your_crayons;
12151215
~~~~
12161216

1217-
## Strings
1218-
1219-
The `~str` type in Rust is represented exactly the same way as a unique
1220-
vector of immutable bytes (`~[u8]`). This sequence of bytes is
1221-
interpreted as an UTF-8 encoded sequence of characters. This has the
1222-
advantage that UTF-8 encoded I/O (which should really be the default
1223-
for modern systems) is very fast, and that strings have, for most
1224-
intents and purposes, a nicely compact representation. It has the
1225-
disadvantage that you only get constant-time access by byte, not by
1226-
character.
1227-
1228-
~~~~
1229-
let huh = ~"what?";
1230-
let que: u8 = huh[4]; // indexing a string returns a `u8`
1231-
assert que == '?' as u8;
1232-
~~~~
1233-
1234-
A lot of algorithms don't need constant-time indexed access (they
1235-
iterate over all characters, which `str::chars` helps with), and
1236-
for those that do, many don't need actual characters, and can operate
1237-
on bytes. For algorithms that do really need to index by character,
1238-
there are core library functions available.
1239-
1240-
> ***Note:*** like vectors, strings will soon be allocatable in
1241-
> the local heap and on the stack, in addition to the exchange heap.
1242-
12431217
## Vector and string methods
12441218

12451219
Both vectors and strings support a number of useful

0 commit comments

Comments
 (0)