当前位置: 首页>>代码示例>>C++>>正文


C++ cString::Length方法代码示例

本文整理汇总了C++中cString::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ cString::Length方法的具体用法?C++ cString::Length怎么用?C++ cString::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cString的用法示例。


在下文中一共展示了cString::Length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FromString

/*int cStringList::FromMem(struct memfile &f) {
	int len;
	int bytes=0;
	bytes+=memread(f,&len,sizeof(int));
	cString temp="";
	char * tempchar=NULL;
	for(int i=0; i<len; i++) {
		tempchar=(char*)f.start;
		tempchar+=f.offset;
		temp=tempchar;
		
		bytes+=temp.Length()+1;
		f.offset+=temp.Length()+1;
		(*this)+=temp;
		temp="";
	}
	if((*this)[-1]=="" && Length()!=0) used--;
	return bytes;
}
*/
void cStringList::FromString(const cString &strng, cString delim) {
	if(delim.Length()==1) return FromString(strng,delim[0]);
	delete [] Array;
	Array=NULL;
	allocated=0;
	used=0;	
	Resize(500);
		
	cString substrng=delim;
	cString temp;
	used=1;
	for(int i=0; i<strng.Length(); ) FromString_innerloop(strng,delim,substrng, i);
}
开发者ID:cmd184psu,项目名称:fs-tools,代码行数:33,代码来源:stringlist.cpp

示例2: FromString_innerloop

void cStringList::FromString_innerloop(const cString & strng, cString delim, cString &substrng, int & i) {
	int s=strng.Length();
	for(int j=0; j<delim.Length() && i+j<strng.Length(); j++) substrng[j]=strng[i+j];
	if(substrng!=delim && i<s) {
		if(used+1>allocated) {
			Resize(allocated+500);
		}
		Array[used-1]+=strng[i];
		i++;
	} else {
		used++;
		i+=substrng.Length();
	}
}
开发者ID:cmd184psu,项目名称:fs-tools,代码行数:14,代码来源:stringlist.cpp

示例3: SetFromString

bool cTimeAndDate::SetFromString(cString s) {

	//date string must be of the form mmddyy
	//but it can be in mddyy if m<10
	if(s.Length()<5) return false;

	if(s.Length()!=6) s="0"+s;
	
	
	cString m="  ",d="  ",y="  ";
	
	m[0]=s[0];
	m[1]=s[1];
	d[0]=s[2];
	d[1]=s[3];
	y[0]=s[4];
	y[1]=s[5];
	
	cTimeAndDate tempdate(m.AtoI(),d.AtoI(), y.AtoI()+2000);
	*this=tempdate;

	return true;
}
开发者ID:cmd184psu,项目名称:fs-tools,代码行数:23,代码来源:timeanddate.cpp

示例4: FromParagraph

void cStringList::FromParagraph(const cString &mystring, int width) {
	
	if(mystring.Length()<width) {
		this->Resize(0);
		(*this)+=mystring;
	
	}
	//step one, create a list of words
	cStringList words;
	words.FromString(mystring," ");
	cStringList newlist;
	//step two, reconstruct a new list of multiple lines with multiple words,
	//conditions: each line may be no more than <width> chars long
	//each line must end in a space.
	cString linebuffer="";
	cString templinebuffer="";
	for(int i=0; i<words.Length(); i++) {
		if(linebuffer=="") {
			linebuffer=words[i];
			templinebuffer=linebuffer;
		} else  {
			templinebuffer=linebuffer+" "+words[i];
		}
		
		if(templinebuffer.Length()>width) {
			//cerr<<"adding "<<linebuffer<<endl;
			newlist+=linebuffer;
			linebuffer=words[i];
		}
		 else {
			//if(linebuffer=="") linebuffer=words[i];
			//else
			 linebuffer=templinebuffer;
		}
	}
	newlist+=linebuffer;
	(*this)=newlist;
}
开发者ID:cmd184psu,项目名称:fs-tools,代码行数:38,代码来源:stringlist.cpp


注:本文中的cString::Length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。