Base64String和十六进制之间的转换 [英] Conversion between Base64String and Hexadecimal

查看:2081
本文介绍了Base64String和十六进制之间的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C ++ / CLI的项目中使用 ToBase64String 来给像一个字符串 / MnwRx7kRZEQBxLZEkXndA == 我要将此字符串转换为十六进制再presentation,我该怎么做,在C ++ / CLI或C#?

I use in my C++/CLI project ToBase64String to give a string like /MnwRx7kRZEQBxLZEkXndA== I want to convert this string to Hexadecimal representation, How I can do that in C++/CLI or C#?

推荐答案

<一个href="http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx">FromBase64String将采取字符串字节取值

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

然后, BitConverter.ToString()将一个字节数组到十六进制字符串(的 C#字节[]以十六进制字符串

Then, BitConverter.ToString() will convert a byte array to a hex string ( C# byte[] to hex string )

string hex = BitConverter.ToString(data);

这篇关于Base64String和十六进制之间的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆