|
- CMyString::strtol(CString strData);
long CMyString::strtol(CString strData, char ** EndPtr, int Radix)
{
long val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::strtol(szData, EndPtr, Radix);
return val;
}
- CMyString::strtoul(CString strData);
unsigned long CMyString::strtoul(CString strData, char ** EndPtr, int Radix)
{
unsigned long val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::strtoul(szData, EndPtr, Radix);
return val;
}
- CMyString::atof(CString strData);
double CMyString::atof(CString strData)
{
double val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::atof( szData );
return val;
}
- CMyString::atoi(CString strData);
int CMyString::atoi(CString strData)
{
int val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::atoi(szData);
return val;
}
- CMyString::atol(CString strData);
long CMyString::atol(CString strData)
{
long val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::atol(szData);
return val;
}
- CMyString::atoll(CString strData);
long long CMyString::atoll(CString strData)
{
long long val;
char szData[512];
strcpy_s(szData, sizeof(szData), strData);
val = ::atoll(szData);
return val;
}
- CMyString::getDataValue(CString strData);
unsigned long CMyString::getDataValue(CString strData)
{
unsigned long val;
char *nstop ;
if ( ( strpos( strData ,_T( "0x" ) ) >= 0 ) ||
( strpos( strData ,_T( "0X" ) ) >= 0 ) ) {
val = strtoul( strData ,&nstop ,16 );
}
else {
val = strtoul( strData ,&nstop ,10 );
}
return val;
}
- CMyString::strpos(CString strBuff, CString cstr);
int CMyString::strpos(CString strBuff, CString cstr)
{
int lb ,lc ,i ,ret ;
ret = -1 ;
lb = strBuff.GetLength();
lc = cstr.GetLength();
for ( i = 0 ; i < (lb -lc + 1) ; i++ ) {
if ( strBuff.Mid( i ,lc ) == cstr ) {
ret = i ;
break ;
}
}
return (ret);
}
- CMyString::strcpy_utf16(CString strBuff, CString cstr);
unsigned long CMyString::strcpy_utf16(char * szData, CString strData)
{
int i, ln, ch ;
// CString cc;
unsigned long j;
ln = strData.GetLength();
j = 0;
szData[j] = (char)0xff;
j++;
szData[j] = (char)0xfe;
j++;
for (i = 0; i < ln; i++) {
ch = (int)strData.GetAt(i);
szData[j] = ch & 0x00ff;
j++;
szData[j] = (ch >> 8) & 0x00ff;
j++;
}
szData[j] = 0;
return j;
}
- CMyString::strcpy_utf16_s(CString strBuff, unsigned long SizeInBytes, CString cstr);
unsigned long CMyString::strcpy_utf16_s(char * szData, unsigned long SizeInBytes, CString strData)
{
int i, ln, ch;
unsigned long j;
ln = strData.GetLength();
j = 0;
szData[j] = (char)0xff;
j++;
szData[j] = (char)0xfe;
j++;
for (i = 0; i < ln; i++) {
ch = (int)strData.GetAt(i);
szData[j] = ch & 0x00ff;
j++;
szData[j] = (ch >> 8) & 0x00ff;
j++;
// コピー上限チェック
if (j >= (SizeInBytes - 1)) {
break;
}
}
szData[j] = 0;
return j;
}
|