Skip to content

Commit f0fa9e6

Browse files
author
José Valim
committed
Add performance note to String.slice/1
1 parent 12f9bf0 commit f0fa9e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/elixir/lib/string.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,10 @@ defmodule String do
10481048
If the start of the range is not a valid offset for the given
10491049
string or if the range is in reverse order, returns `""`.
10501050
1051+
If the start or end of the range are negative, the whole string
1052+
is traversed first in order to convert the negative indexes into
1053+
positive ones.
1054+
10511055
Remember this function works with unicode codepoints and consider
10521056
the slices to represent codepoints offsets. If you want to split
10531057
on raw bytes, check `Kernel.binary_part/3` instead.

0 commit comments

Comments
 (0)