mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
encoding.base64: fix doc comment examples
This commit is contained in:
parent
cf2bff504d
commit
7d08554c3c
1 changed files with 2 additions and 2 deletions
|
@ -187,7 +187,7 @@ mut:
|
|||
|
||||
// decode decodes the base64 encoded `string` value passed in `data`.
|
||||
// Please note: If you need to decode many strings repeatedly, take a look at `decode_in_buffer`.
|
||||
// Example: assert base64.decode('ViBpbiBiYXNlIDY0') == 'V in base 64'
|
||||
// Example: assert base64.decode('ViBpbiBiYXNlIDY0') == 'V in base 64'.bytes()
|
||||
pub fn decode(data string) []u8 {
|
||||
mut size := i64(data.len) * 3 / 4
|
||||
if size <= 0 || data.len % 4 != 0 {
|
||||
|
@ -218,7 +218,7 @@ pub fn decode_str(data string) string {
|
|||
// encode encodes the `[]u8` value passed in `data` to base64.
|
||||
// Please note: base64 encoding returns a `string` that is ~ 4/3 larger than the input.
|
||||
// Please note: If you need to encode many strings repeatedly, take a look at `encode_in_buffer`.
|
||||
// Example: assert base64.encode('V in base 64') == 'ViBpbiBiYXNlIDY0'
|
||||
// Example: assert base64.encode('V in base 64'.bytes()) == 'ViBpbiBiYXNlIDY0'
|
||||
pub fn encode(data []u8) string {
|
||||
return alloc_and_encode(data.data, data.len)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue