util.cpp
来自「管理项目进度工具的原代码」· C++ 代码 · 共 53 行
CPP
53 行
#include "stdafx.h"
#include "util.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CString LongToString(long newValue)
{
long lvalue;
CString str_rtc;
lvalue = newValue;
str_rtc.Format("%d",lvalue);
return str_rtc;
} //LongToString()
long StringToLong(CString newValue)
{
long lvalue;
char *p_str;
char *p_endstr;
CString str;
str = newValue;
p_str=(LPSTR) LPCTSTR(str);
lvalue = strtol(p_str, &p_endstr, 10);
return lvalue;
} //StringToLong()
void StringToArray(const CString& strSrc, CStringArray& trgt) {
CString strDelimiter=";";
CString strElement;
long lPosition=0;
while (lPosition<strSrc.GetLength()) {
if ((strDelimiter.Find(strSrc.GetAt(lPosition))>=0)) {
trgt.Add(strElement);
strElement = "";
} else {
strElement += strSrc.GetAt(lPosition);
} //if-else is_field_delimiter
lPosition++;
}
trgt.Add(strElement); // add last
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?