#region 将Base64编码的文本转换成普通文本 /// <summary> /// 将Base64编码的文本转换成普通文本 /// </summary> /// <param name="base64">Base64编码的文本</param> /// <returns></returns> public static string Base64StringToString(string base64) { if (base64 != "") { char[] charBuffer = base64.ToCharArray(); byte[] bytes = Convert.FromBase64CharArray(charBuffer, 0, charBuffer.Length); string returnstr = Encoding.Default.GetString(bytes); return returnstr; } else { return ""; } } #endregion #region 字符串转为base64字符串 public static string changebase64(string str) { if (str != "" && str != null) { byte[] b = Encoding.Default.GetBytes(str); string returnstr = Convert.ToBase64String(b); return returnstr; } else { return ""; } } #endregion
时间: 2024-11-05 23:37:57