@@ -27,7 +27,7 @@ pub fn is_empty(str: String) -> Bool {
27
27
/// Gets the number of grapheme clusters in a given `String`.
28
28
///
29
29
/// This function has to iterate across the whole string to count the number of
30
- /// graphemes, so it runs in linear time.
30
+ /// graphemes, so it runs in linear time. Avoid using this in a loop.
31
31
///
32
32
/// ## Examples
33
33
///
@@ -53,7 +53,7 @@ pub fn length(string: String) -> Int
53
53
/// Reverses a `String`.
54
54
///
55
55
/// This function has to iterate across the whole `String` so it runs in linear
56
- /// time.
56
+ /// time. Avoid using this in a loop.
57
57
///
58
58
/// ## Examples
59
59
///
@@ -160,6 +160,10 @@ fn less_than(a: String, b: String) -> Bool
160
160
/// Takes a substring given a start grapheme index and a length. Negative indexes
161
161
/// are taken starting from the *end* of the list.
162
162
///
163
+ /// This function runs in linear time with the size of the index and the
164
+ /// length. Negative indexes are linear with the size of the input string in
165
+ /// addition to the other costs.
166
+ ///
163
167
/// ## Examples
164
168
///
165
169
/// ```gleam
@@ -252,7 +256,7 @@ pub fn drop_start(from string: String, up_to num_graphemes: Int) -> String {
252
256
/// Drops *n* graphemes from the end of a `String`.
253
257
///
254
258
/// This function traverses the full string, so it runs in linear time with the
255
- /// size of the string.
259
+ /// size of the string. Avoid using this in a loop.
256
260
///
257
261
/// ## Examples
258
262
///
@@ -805,6 +809,9 @@ pub fn first(string: String) -> Result(String, Nil) {
805
809
/// `Result(String, Nil)`. If the `String` is empty, it returns `Error(Nil)`.
806
810
/// Otherwise, it returns `Ok(String)`.
807
811
///
812
+ /// This function traverses the full string, so it runs in linear time with the
813
+ /// length of the string. Avoid using this in a loop.
814
+ ///
808
815
/// ## Examples
809
816
///
810
817
/// ```gleam
0 commit comments