vb6strfunctocpp.cpp

来自「VB6 has two very useful string functions」· C++ 代码 · 共 36 行

CPP
36
字号
// VB6strFuncToCPP.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include "MFCstring.h"
using namespace NotMFC;

#include "VB6functions.h"
using namespace VB6;

using namespace std;

int main(int argc, char* argv[])
{
  vector<CString> ss,fs; long i;
	CString s1 = "Key", s2="Value";
	ss.push_back(s1);
	ss.push_back(s2);
	//ss.push_back("Default");
	CString out = Join(ss,"=");
	printf("Join: %s,%s -> %s\n\n",s1.c_str(),s2.c_str(),out.c_str());

	CString sMulti = "Name,Surname,Address,Tel";
	fs = Split(sMulti,",");

	printf("Split: %s (%d items)\n",sMulti.c_str(),fs.size());
  for(i=0; i<fs.size(); i++)
		printf("%s\n",fs[i].c_str());

	CString f1 = "Filip";
	CString f2 = Replace(f1,"F","Ph");
	printf("\nReplace example: %s -> %s\n",f1.c_str(),f2.c_str());
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?