字符串经过base64编码后的长度与原字符串的长度是什么关系呀?

beforeEncode为Encode之前的字符串

那么Encode后的字符串长度为:

1、如果beforeEncode.length()是3的整数倍,那么长度为

 (beforeEncode.length()/3)*4

2、如果beforeEncode.length()不是3的整数倍,那么长度为

(beforeEncode.length()/3+1)*4

猜你喜欢

转载自www.cnblogs.com/beli/p/9272867.html