diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-11 21:37:22 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-12 12:21:04 +1000 |
| commit | 3ac00a94895f4d9a8119ef35494fddb9d66436ae (patch) | |
| tree | 05891e2d06bdd87071ec5df904f746494bdf8f7b /doc/tutorial.md | |
| parent | 9fff8c6eba287e0ed7cce6014dc58482afe425b0 (diff) | |
| download | rust-3ac00a94895f4d9a8119ef35494fddb9d66436ae.tar.gz rust-3ac00a94895f4d9a8119ef35494fddb9d66436ae.zip | |
std: remove substr & str::count_*, methodise char_len, implement slice_chars.
The confusing mixture of byte index and character count meant that every use of .substr was incorrect; replaced by slice_chars which only uses character indices. The old behaviour of `.substr(start, n)` can be emulated via `.slice_from(start).slice_chars(0, n)`.
Diffstat (limited to 'doc/tutorial.md')
| -rw-r--r-- | doc/tutorial.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index f487398d19c..a4580361166 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1410,7 +1410,7 @@ let new_favorite_crayon_name = favorite_crayon_name.trim(); if favorite_crayon_name.len() > 5 { // Create a substring - println(favorite_crayon_name.substr(0, 5)); + println(favorite_crayon_name.slice_chars(0, 5)); } ~~~ |
