<tfoot id='Vnxvx'></tfoot>

    <bdo id='Vnxvx'></bdo><ul id='Vnxvx'></ul>

<small id='Vnxvx'></small><noframes id='Vnxvx'>

    1. <i id='Vnxvx'><tr id='Vnxvx'><dt id='Vnxvx'><q id='Vnxvx'><span id='Vnxvx'><b id='Vnxvx'><form id='Vnxvx'><ins id='Vnxvx'></ins><ul id='Vnxvx'></ul><sub id='Vnxvx'></sub></form><legend id='Vnxvx'></legend><bdo id='Vnxvx'><pre id='Vnxvx'><center id='Vnxvx'></center></pre></bdo></b><th id='Vnxvx'></th></span></q></dt></tr></i><div id='Vnxvx'><tfoot id='Vnxvx'></tfoot><dl id='Vnxvx'><fieldset id='Vnxvx'></fieldset></dl></div>
      1. <legend id='Vnxvx'><style id='Vnxvx'><dir id='Vnxvx'><q id='Vnxvx'></q></dir></style></legend>
      2. 如何将一串十六进制值转换为一个字符串?

        时间:2024-05-12

          <legend id='iYruZ'><style id='iYruZ'><dir id='iYruZ'><q id='iYruZ'></q></dir></style></legend>

          1. <i id='iYruZ'><tr id='iYruZ'><dt id='iYruZ'><q id='iYruZ'><span id='iYruZ'><b id='iYruZ'><form id='iYruZ'><ins id='iYruZ'></ins><ul id='iYruZ'></ul><sub id='iYruZ'></sub></form><legend id='iYruZ'></legend><bdo id='iYruZ'><pre id='iYruZ'><center id='iYruZ'></center></pre></bdo></b><th id='iYruZ'></th></span></q></dt></tr></i><div id='iYruZ'><tfoot id='iYruZ'></tfoot><dl id='iYruZ'><fieldset id='iYruZ'></fieldset></dl></div>

            <small id='iYruZ'></small><noframes id='iYruZ'>

              <bdo id='iYruZ'></bdo><ul id='iYruZ'></ul>
                <tbody id='iYruZ'></tbody>
              <tfoot id='iYruZ'></tfoot>
                • 本文介绍了如何将一串十六进制值转换为一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  假设我有一个字符串:

                  string hex = "48656c6c6f";
                  

                  其中每两个字符对应于其 ASCII 值的十六进制表示,例如:

                  Where every two characters correspond to the hex representation of their ASCII, value, eg:

                  0x48 0x65 0x6c 0x6c 0x6f = "Hello"
                  

                  那么如何从 "48656c6c6f" 获取 "hello" 而不必创建查找 ASCII 表?atoi() 显然在这里不起作用.

                  So how can I get "hello" from "48656c6c6f" without having to create a lookup ASCII table? atoi() obviously won't work here.

                  推荐答案

                  int len = hex.length();
                  std::string newString;
                  for(int i=0; i< len; i+=2)
                  {
                      std::string byte = hex.substr(i,2);
                      char chr = (char) (int)strtol(byte.c_str(), null, 16);
                      newString.push_back(chr);
                  }
                  

                  这篇关于如何将一串十六进制值转换为一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:`std::set` 有什么问题? 下一篇:STL MAP 应该使用 find() 或 [n] 标识符来查找地图中的元素吗?

                  相关文章

                  <small id='AK5Ay'></small><noframes id='AK5Ay'>

                • <legend id='AK5Ay'><style id='AK5Ay'><dir id='AK5Ay'><q id='AK5Ay'></q></dir></style></legend><tfoot id='AK5Ay'></tfoot>

                      <bdo id='AK5Ay'></bdo><ul id='AK5Ay'></ul>

                    1. <i id='AK5Ay'><tr id='AK5Ay'><dt id='AK5Ay'><q id='AK5Ay'><span id='AK5Ay'><b id='AK5Ay'><form id='AK5Ay'><ins id='AK5Ay'></ins><ul id='AK5Ay'></ul><sub id='AK5Ay'></sub></form><legend id='AK5Ay'></legend><bdo id='AK5Ay'><pre id='AK5Ay'><center id='AK5Ay'></center></pre></bdo></b><th id='AK5Ay'></th></span></q></dt></tr></i><div id='AK5Ay'><tfoot id='AK5Ay'></tfoot><dl id='AK5Ay'><fieldset id='AK5Ay'></fieldset></dl></div>