C++ 在字符串中插入子串+判断字符串是否由空格组成

// Example3.cpp : 定义控制台应用程序的入口点。

#include "StdAfx.h"
#include 
#include 
using namespace std;

int main(void)
{
	string str,str1,str2;
	int index;

	//判断截取的子串是否由blanks组成
	str="   cjc is a master.";
	str1="cjc is a master.";
	index=str.find("cjc");
	str.assign(str.c_str(),index);
	
	if(str.find_first_not_of(" ")==-1)
	{
		cout<<"The string is constructed of blanks..."<

你可能感兴趣的:(C/C++)