📄 example.cpp
字号:
// Example.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Example.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString str1="First Second Third Fourth Fifth Sixth";
CString str2="Third";
int pos;
CString str3;
pos=str1.Find(str2);
str3=str1.Mid(pos,10);
printf("Find 和Mid 函数结果:%s\n",str3);
pos=str1.FindOneOf("STF");
str3=str1.Left(10);
printf("FindOneOf和Left函数结果:%s\n",str3);
pos=str1.ReverseFind('S');
str3=str1.Right(10);
printf("ReverseFind和Right函数结果:%s\n",str3);
getchar();
}
return nRetCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -