📜  baze64 长度 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:54.636000             🧑  作者: Mango

代码示例1
public int GetOriginalLengthInBytes(string base64string)
{
    if (string.IsNullOrEmpty(base64string)) { return 0; }

    var characterCount = base64string.Length;
    var paddingCount = base64string.Substring(characterCount - 2, 2)
                                   .Count(c => c == '=');
    return (3 * (characterCount / 4)) - paddingCount;
}