/* * Created by PyramIDE. * User: フランスのトトロ aka (David RENÉ) * Date: 12/07/2017 * Time: 22:02 * © Calexium */ read tools/base64.anubis read tools/basis.anubis read system/string.anubis public define String to_folded_base64_text ( String charset, String text, ) = with l = length(text), max_length = (Int)48, if l > max_length then if sub_string(text, 0, max_length) is { failure then "", // can't occures success(left_text) then with text2 = "=?"+charset+"?B?"+to_string(base64_encode(to_byte_array(left_text)))+"?=", if sub_string(text, max_length, l - max_length) is { failure then "", // can't occures success(rigth_text) then text2 + crlf + " " + to_folded_base64_text(charset, rigth_text) } } else if l > 0 then "=?"+charset+"?B?"+to_string(base64_encode(to_byte_array(text)))+"?=" //find_and_replace(text2, implode([13,10]), implode([13,10,32])) else "".