Skip to content

Commit a785f86

Browse files
erikareadslpil
authored andcommitted
docs: Add string.byte_size example
1 parent 82559e9 commit a785f86

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/gleam/string.gleam

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,13 @@ fn do_inspect(term term: anything) -> StringBuilder
901901
/// This function runs in constant time on Erlang and in linear time on
902902
/// JavaScript.
903903
///
904+
/// ## Examples
905+
///
906+
/// ```gleam
907+
/// > byte_size("🏳️‍⚧️🏳️‍🌈👩🏾‍❤️‍👨🏻")
908+
/// 58
909+
/// ```
910+
///
904911
@external(erlang, "erlang", "byte_size")
905912
@external(javascript, "../gleam_stdlib.mjs", "byte_size")
906913
pub fn byte_size(string: String) -> Int

0 commit comments

Comments
 (0)