gpt4 book ai didi

c# - Base64String与十六进制之间的转换

转载 作者:太空狗 更新时间:2023-10-29 20:46:13 26 4
gpt4 key购买 nike

我在我的 C++/CLI 项目中使用 ToBase64String 来提供类似 /MnwRx7kRZEQBxLZEkXndA== 的字符串 我想将此字符串转换为十六进制表示,我该怎么做在 C++/CLI 或 C# 中?

最佳答案

FromBase64Stringstring 转换为 byte

byte[] bytes = Convert.FromBase64String(string s);

然后,BitConverter.ToString() 会将字节数组转换为十六进制字符串 ( byte[] to hex string )

string hex = BitConverter.ToString(bytes);

关于c# - Base64String与十六进制之间的转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7784345/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com