mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin: document the rune.length_in_bytes method (#13826)
This commit is contained in:
parent
347db755c8
commit
ea4410cdb5
1 changed files with 2 additions and 0 deletions
|
@ -61,6 +61,8 @@ pub fn (c rune) bytes() []byte {
|
||||||
return res
|
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 {
|
pub fn (c rune) length_in_bytes() int {
|
||||||
code := u32(c)
|
code := u32(c)
|
||||||
if code <= 0x7F {
|
if code <= 0x7F {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue