beforeEncode为Encode之前的字符串
那么Encode后的字符串长度为:
1、如果beforeEncode.length()是3的整数倍,那么长度为
(beforeEncode.length()/3)*4
2、如果beforeEncode.length()不是3的整数倍,那么长度为
(beforeEncode.length()/3+1)*4
本文详细解析了Base64编码前后字符串长度变化规律。在Base64编码中,如果原始字符串长度为3的倍数,编码后长度为其四分之三;若非3的倍数,则编码后长度为原始长度除以3向上取整再乘以4。这一规则对于理解Base64编码原理及应用至关重要。
beforeEncode为Encode之前的字符串
那么Encode后的字符串长度为:
1、如果beforeEncode.length()是3的整数倍,那么长度为
(beforeEncode.length()/3)*4
2、如果beforeEncode.length()不是3的整数倍,那么长度为
(beforeEncode.length()/3+1)*4
转载于:https://www.cnblogs.com/beli/p/9272867.html

被折叠的 条评论
为什么被折叠?