Skip to content

Commit

Permalink
builtin: document the rune.length_in_bytes method (#13826)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel committed Mar 25, 2022
1 parent 347db75 commit ea4410c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vlib/builtin/rune.v
Expand Up @@ -61,6 +61,8 @@ pub fn (c rune) bytes() []byte {
return res
}

// length_in_bytes returns the number of bytes needed to store the code point.
// Returns -1 if the data is not a valid code point.
pub fn (c rune) length_in_bytes() int {
code := u32(c)
if code <= 0x7F {
Expand Down

0 comments on commit ea4410c

Please sign in to comment.