'' 是 base64 编码的吗?

Is '' base64 encoded?

''是base64编码的吗?

This question 有这个答案表明没有:

if (str ==='' || str.trim() ===''){ return false; }

但其他一些使用正则表达式的方法 return 正确...例如:

https://stackblitz.com/edit/js-xjubhf

想法?

是的。

空字符串在 BASE64 中被编码(并被解码)为空字符串。

注:BASE64标准中准确的第一个引用测试是空字符串:

BASE64("") = ""

来自 RFC 4648.