1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: fix comment examples in int.v (#7902)

This commit is contained in:
Larpon 2021-01-06 19:02:04 +01:00 committed by GitHub
parent 9025c3528f
commit dcc8310bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -439,11 +439,13 @@ pub fn (nn voidptr) hex_full() string { return u64_to_hex(nn, 16) }
pub fn (nn byteptr) hex_full() string { return u64_to_hex(nn, 16) } pub fn (nn byteptr) hex_full() string { return u64_to_hex(nn, 16) }
*/ */
// str returns the contents of `byte` as a zero terminated `string`. // str returns the contents of `byte` as a zero terminated `string`.
// Example: assert byte(111).str() == 'o' // Example: assert byte(111).str() == '111'
pub fn (b byte) str() string { pub fn (b byte) str() string {
return int(b).str_l(7) return int(b).str_l(7)
} }
// ascii_str returns the contents of `byte` as a zero terminated ASCII `string` character.
// Example: assert byte(97).ascii_str() == 'a'
pub fn (b byte) ascii_str() string { pub fn (b byte) ascii_str() string {
mut str := string{ mut str := string{
str: malloc(2) str: malloc(2)