📄 stroper1.cpp
字号:
// StrOper1.cpp: implementation of the StrOper1 class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "bianyi.h"
#include "StrOper1.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
StrOper1::StrOper1()
{
}
StrOper1::~StrOper1()
{
}
int StrOper1::strtoint(string s)
{
return atoi(s.data());
}
string StrOper1::inttostr(int a)
{
int b,c;
char *buf=new char[10];
if(a==0)
{
memset(buf,0,10);
buf[0]=48;
}
else
{
buf=ecvt(a,10,&b,&c);
for(int i=b;i<=strlen(buf);i++)
{
buf[i]=0;
}
}
string s=buf;
return s;
}
char StrOper1::read(char *a)
{
int len=strlen(a);
char buf=a[0];
int i;
for(i=0;i<len-1;i++)
{
a[i]=a[i+1];
}
a[i]=0;
return buf;
}
char StrOper1::getone(char *a)
{
return a[0];
}
void StrOper1::chartostr(string & s,char a)
{
char * gg=new char[10];
memset(gg,0,10);
gg[0]=a;
s=gg;
}
string StrOper1::chartstr(char a)
{
string s;
char * gg=new char[10];
memset(gg,0,10);
gg[0]=a;
s=gg;
return s;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -