• base64


    模块说明

    base64编解码,RFC2045和RFC4648,如果有疑问可看RFC。

    • 编码结果比原来大约33%
    • decode和decode_to_string 仅仅忽略空白字符,如空白符、tab、 等
    • mime_decode和mime_decode_to_string 忽略不合法字符

    Data Types
    ascii_string() = [1..255]
    ascii_binary() = binary()
    ascii 的字符串或者binary

    导出函数

    • encode(ascii_string() 或者 ascii_binary() )  : 返回 base64 的 ascii_binary
    • encode_to_string/1  : 参数同上,返回base64 的 ascii_string
    • decode(base64的ascii_string或ascii_binary)   : 返回解码后的ascii_binary
    • decode_to_string/1 : 参数同上,返回解码后的ascii_string
    • mime_decode/1 : 同上,解码返回ascii_binary
    • mime_decode_to_string/1 : 同上,解码返回ascii_string

    例子

     base64:encode("123") = <<"MTIz">>.

     base64:encode(<<"123">>) = <<"MTIz">>.

     base64:encode_to_string("123") = "MTIz".

     base64:encode_to_string(<<"123">>) = "MTIz".
     
    base64:decode(<<"MTIz">>) = <<"123">>.

     base64:decode("MTIz") = <<"123">>.
    base64:decode_to_string("MTIz") = "123".
    base64:decode_to_string(<<"MTIz" >>) = "123".
     base64:encode(" 123 ") = <<"IDEyMyA=">>.
     base64:decode(" MTIz ") = <<"123">>.

  • 相关阅读:
    [atARC088F]Christmas Tree
    [atARC109F]1D Kingdom Builder
    [luogu4259]寻找车位
    [atARC087F]Squirrel Migration
    [atARC087E]Prefix-free Game
    [atARC110F]Esoswap
    [atARC110E]Shorten ABC
    [atARC084D]Small Multiple
    [atARC083F]Collecting Balls
    [hihocoder][Offer收割]编程练习赛49
  • 原文地址:https://www.cnblogs.com/rubyist/p/erlang_stdlib_base64.html
Copyright © 2020-2023  润新知