zoukankan      html  css  js  c++  java
  • 16进制(字符串)转换成2进制(字符串)

    CString myProject::Convert16To2(CString strSource)
    {
       //转换成大写字母
       strSource.MakeUpper();
       CString strDest;
       for( int i = 0;i < strSource.GetLength();i++ )
       {
          if(strSource.GetAt(i) == '0')
            strDest += _T("0000");
          if(strSource.GetAt(i) == '1')
             strDest += _T("0001");
          if(strSource.GetAt(i) == '2')
             strDest += _T("0010");
          if(strSource.GetAt(i) == '3')
             strDest += _T("0011");
          if(strSource.GetAt(i) == '4')
             strDest += _T("0100");
          if(strSource.GetAt(i) == '5')
             strDest += _T("0101");
          if(strSource.GetAt(i) == '6')
             strDest += _T("0110");
          if(strSource.GetAt(i) == '7')
             strDest += _T("0111");
          if(strSource.GetAt(i) == '8')
             strDest += _T("1000");
          if(strSource.GetAt(i) == '9')
             strDest += _T("1001");
          if(strSource.GetAt(i) == 'A')
             strDest += _T("1010");
          if(strSource.GetAt(i) == 'B')

           strDest += _T("1011");
          if(strSource.GetAt(i) == 'C')
             strDest += _T("1100");
          if(strSource.GetAt(i) == 'D')
             strDest += _T("1101");
          if(strSource.GetAt(i) == 'E')
             strDest += _T("1110");
          if(strSource.GetAt(i) == 'F')
             strDest += _T("1111");
       }
       return strDest;
    }

  • 相关阅读:
    观察者模式
    hdu 4712 Hamming Distance bfs
    leetcode Sum Root to Leaf Numbers(所有路径之和)
    Oracle实用-01:绑定变量
    jQuery实现AJAX定时刷新局部页面实例
    给Ajax一个漂亮的嫁衣——Ajax系列之五(下)之序列化和反序列化
    jquery的ajax同步和异步
    报表技术
    告别.NET生成报表统计图的烦恼
    浅谈ASP.NET报表控件
  • 原文地址:https://www.cnblogs.com/pbreak/p/1759562.html
Copyright © 2011-2022 走看看