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;
    }

  • 相关阅读:
    WordPress让文本小工具支持简码
    修改WordPress后台登录地址,提高安全性
    WordPress用键盘左右方向键来查看上一篇和下一篇文章
    Git 补丁操作
    Git 标签操作
    Git 修正错误
    Git 删除操作
    Git 重命名操作
    Git 移动操作
    Git 藏匿操作
  • 原文地址:https://www.cnblogs.com/pbreak/p/1759562.html
Copyright © 2011-2022 走看看