📄 digit.cpp
字号:
// DIGIT.cpp: implementation of the DIGIT class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CREATOR.h"
#include "DIGIT.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DIGIT::DIGIT()
{
}
DIGIT::~DIGIT()
{
}
int DIGIT::XtoD(char ch)
{char ch2=toupper(ch);
if(ch2>='0'&&ch2<='9') return ch2-'0';
if(ch2>='A'&&ch2<='F') return ch2-'A'+10;
return 0;
}
int DIGIT::XtoD(CString string)
{int i=0,s=0;
BOOL flag=FALSE;
while(1)
{char ch=string.GetAt(i);
if(!IsXDigitchar(string.GetAt(i))){i++;continue;}
//如果是数字串结尾了,就跳出循环
s*=16;
s+=XtoD(string.GetAt(i++));
if(i==string.GetLength()||!IsXDigitchar(string.GetAt(i))) break;
}
return s;
}
BOOL DIGIT::IsXDigitchar(char ch)
{char ch2=toupper(ch);
if((ch2>='0'&&ch2<='9')||(ch2>='A'&&ch2<='F'))
return TRUE;
else return FALSE;
}
BOOL DIGIT::IsDDigitchar(char ch)
{if(ch>='0'&&ch<='9') return TRUE;
else return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -