V语言Base64编码/解码代码示例

  V语言中文网  |   1846 |    2019-09-21 13:26:22

Base64编码/解码是开发过程中常用的功能,今天记录下V语言中使用Base64编码/解码的代码示例,希望能为您带来帮助。

import encoding.base64
fn main(){
  content:='hello world!' //测试内容
  encode_content:=base64.encode(content)
  println('content:$content')
  println('encode:$encode_content')
  decode_content:=base64.decode(encode_content)
  println('decode:$decode_content')
}

编译后执行,输出以下内容:

content:hello world! encode:aGVsbG8gd29ybGQh decode:hello world!

代码如有疏漏或不足之处,欢迎指正。


登陆后可发表评论


热门评论

暂无评论


最新评论

暂无评论