File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -646,10 +646,12 @@ defmodule String do
646
646
The offset is capped to the length of the string. Returns a tuple with
647
647
two elements.
648
648
649
- Note: keep in mind this function splits on graphemes and for such it
650
- has to linearly traverse the string. If you want to split a string or
651
- a binary based on the number of bytes, use `Kernel.binary_part/3`
652
- instead.
649
+ > #### Linear Access {: .warning}
650
+ >
651
+ > This function splits on graphemes and for such it has to linearly traverse
652
+ > the string.
653
+ > If you want to split a string or a binary based on the number of bytes,
654
+ > use `Kernel.binary_part/3` instead.
653
655
654
656
## Examples
655
657
@@ -2231,6 +2233,12 @@ defmodule String do
2231
2233
Returns the grapheme at the `position` of the given UTF-8 `string`.
2232
2234
If `position` is greater than `string` length, then it returns `nil`.
2233
2235
2236
+ > #### Linear Access {: .warning}
2237
+ >
2238
+ > This function has to linearly traverse the string.
2239
+ > If you want to access a string or a binary in constant time based on the
2240
+ > number of bytes, use `Kernel.binary_slice/3` or `:binary.at/2` instead.
2241
+
2234
2242
## Examples
2235
2243
2236
2244
iex> String.at("elixir", 0)
You can’t perform that action at this time.
0 commit comments