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


C++ TStr::SplitOnStr方法代码示例

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


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

示例1: GetAuthNmVPubStr

void TGgSchRef::GetAuthNmVPubStr(
 const TStr& AuthNmVPubStr, TStrV& AuthNmV, TStr& PubNm, TStr& PubYearStr){
  // split input string into two parts
  TStr AuthNmVStr; TStr PubStr;
  AuthNmVPubStr.SplitOnStr(AuthNmVStr, " - ", PubStr);
  // author-names string
  AuthNmVStr.SplitOnAllCh(',', AuthNmV, true);
  for (int AuthN=0; AuthN<AuthNmV.Len(); AuthN++){
    AuthNmV[AuthN].ToTrunc();
  }
  if ((!AuthNmV.Empty())&&
   ((AuthNmV.Last().IsStrIn("..."))||(AuthNmV.Last().Len()<=2))){
    AuthNmV.DelLast();
  }
  // publication-name & publication-year string
  TStr OriginStr; TStr LinkStr;
  PubStr.SplitOnStr(OriginStr, " - ", LinkStr);
  OriginStr.SplitOnLastCh(PubNm, ',', PubYearStr);
  PubNm.ToTrunc(); PubYearStr.ToTrunc();
  if ((PubYearStr.Len()>=4)&&(PubYearStr.GetSubStr(0, 3).IsInt())){
    PubYearStr=PubYearStr.GetSubStr(0, 3);
  } else
  if ((PubNm.Len()>=4)&&(PubNm.GetSubStr(0, 3).IsInt())){
    PubYearStr=PubNm.GetSubStr(0, 3); PubNm="";
  } else {
    PubYearStr="";
  }
}
开发者ID:Accio,项目名称:snap,代码行数:28,代码来源:google.cpp

示例2: GetStdNameV

void TStrUtil::GetStdNameV(TStr AuthorNames, TStrV& StdNameV) {
  AuthorNames.ChangeChAll('\n', ' ');
  AuthorNames.ToLc();
  // split into author names
  TStrV AuthV, TmpV, Tmp2V;
  // split on 'and'
  AuthorNames.SplitOnStr(" and ", TmpV);
  int i;
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(',', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on '&'
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh('&', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on ','
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(',', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on ';'
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(';', Tmp2V);  AuthV.AddV(Tmp2V); }
  // standardize names
  StdNameV.Clr();
  //printf("\n*** %s\n", AuthorNames.CStr());
  for (i = 0; i < AuthV.Len(); i++) {
    TStr StdName = GetStdName(AuthV[i]);
    if (! StdName.Empty()) {
      //printf("\t%s  ==>  %s\n", AuthV[i].CStr(), StdName.CStr());
      StdNameV.Add(StdName);
    }
  }
}
开发者ID:hmipakchi,项目名称:FinalYearProject,代码行数:33,代码来源:util.cpp

示例3: ExtrEuPartV

void TCordisEuPart::ExtrEuPartV(const TStr& AllEuPartStr, TCordisEuPartV& EuPartV){
  TStrV EuPartStrV; AllEuPartStr.SplitOnStr("Organisation Type:", EuPartStrV);
  for (int EuPartN=1; EuPartN<EuPartStrV.Len(); EuPartN++){
    TStr EuPartStr=EuPartStrV[EuPartN];
    TStr WcStr=
     "</span>*</td>"
     "*Organisation:</span>*<br>"
     "*</td>*";
    TStrV StarStrV;
    if (EuPartStr.IsWcMatch(WcStr, StarStrV)){
      PCordisEuPart EuPart=TCordisEuPart::New();
      EuPart->DeptNm=ExtrDeptNm(EuPartStr);
      EuPart->OrgNm=TXmlLx::GetPlainStrFromXmlStr(StarStrV[2].GetTrunc());
      EuPart->OrgTypeNm=StarStrV[0].GetTrunc();
      EuPart->CountryNm=ExtrCountry(StarStrV[3].GetTrunc());
      EuPart->CoordP=(EuPartN==1);
      printf("   Partner: '%s'/'%s'/'%s'/'%s'/'%s'\n",
       EuPart->DeptNm.CStr(), EuPart->OrgNm.CStr(),
       EuPart->OrgTypeNm.CStr(), EuPart->CountryNm.CStr(),
       TBool::GetStr(EuPart->CoordP).CStr());
      EuPartV.Add(EuPart);
    } else {
      printf("Partner Fields Not Found!\n");
    }
  }
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:26,代码来源:cordis.cpp

示例4: TInt

DCluster::DCluster(TStr LineInput) {
  // Parse start/end date
  TStrV Params;
  LineInput.SplitOnStr("\t", Params);
  Id = TInt(Params[0].GetInt());
  Start = TSecTm::GetDtTmFromYmdHmsStr(Params[1]);
  End = TSecTm::GetDtTmFromYmdHmsStr(Params[2]);
  uint StartDay = Start.GetInUnits(tmuDay);
  uint EndDay = End.GetInUnits(tmuDay);
  DiffDay = EndDay - StartDay + 1;

  // Stats/size
  Unique = TInt(Params[3].GetInt());
  Size = TInt(Params[4].GetInt());
  NumPeaks = TInt(Params[5].GetInt());
  RepStrLen = TInt(Params[6].GetInt());

  // Strings
  RepStr = Params[7];
  RepURL = Params[8];

  // Peak times
  First = TSecTm::GetDtTmFromYmdHmsStr(Params[9]);
  Last = TSecTm::GetDtTmFromYmdHmsStr(Params[10]);
  Peak = TSecTm::GetDtTmFromYmdHmsStr(Params[11]);
  bool ArchiveBool = true;
  Params[12].IsBool(ArchiveBool);
  Archived = TBool(ArchiveBool);
  DiscardState = TInt(Params[13].GetInt());
}
开发者ID:snap-stanford,项目名称:curis-2012,代码行数:30,代码来源:analyzer.cpp

示例5:

///// Splits on the first occurrence of the target string
///// if the target string is not found the whole string is returned as the left side
//void SplitOnStr(TStr& LStr, const TStr& SplitStr, TStr& RStr) const;
TEST(TStr, SplitOnStr) {
	const TStr Str = "abcd";
	const TStr EmptyStr = "";
	TStr LStr, RStr;
	
	// left empty
	Str.SplitOnStr(LStr, "ab", RStr);
	EXPECT_EQ(LStr, "");
	EXPECT_EQ(RStr, "cd");
	
	// both nonempty
	Str.SplitOnStr(LStr, "bc", RStr);
	EXPECT_EQ(LStr, "a");
	EXPECT_EQ(RStr, "d");
	
	// right empty
	Str.SplitOnStr(LStr, "cd", RStr);
	EXPECT_EQ(LStr, "ab");
	EXPECT_EQ(RStr, "");
	
	// both empty
	Str.SplitOnStr(LStr, "abcd", RStr);
	EXPECT_EQ(LStr, "");
	EXPECT_EQ(RStr, "");
	
	// no-match
	Str.SplitOnStr(LStr, "fg", RStr);
	EXPECT_EQ(LStr, Str);
	EXPECT_EQ(RStr, "");
	Str.SplitOnStr(LStr, "abcde", RStr);
	EXPECT_EQ(LStr, Str);
	EXPECT_EQ(RStr, "");
	Str.SplitOnStr(LStr, "", RStr);
	EXPECT_EQ(LStr, Str);
	EXPECT_EQ(RStr, "");
	
	// empty
	EmptyStr.SplitOnStr(LStr, "aa", RStr);
	EXPECT_EQ(LStr, "");
	EXPECT_EQ(RStr, "");
	EmptyStr.SplitOnStr(LStr, "", RStr);
	EXPECT_EQ(LStr, "");
	EXPECT_EQ(RStr, "");
}
开发者ID:gitter-badger,项目名称:qminer,代码行数:47,代码来源:test-TStr.cpp

示例6: ExtrCountry

/////////////////////////////////////////////////
// EuPartner
TStr TCordisEuPart::ExtrCountry(const TStr& AddrStr){
  TStr CountryStr;
  TStrV LnV; AddrStr.SplitOnStr("<br>", LnV);
  if (LnV.Len()>0){
    CountryStr=LnV.Last();
    if (CountryStr.Empty()&&(LnV.Len()>1)){
      CountryStr=LnV[LnV.Len()-2];}
    CountryStr.DelChAll('\r');
    CountryStr.DelChAll('\n');
  }
  if (CountryStr.Empty()){
    printf("Country Field Not Found!\n");}
  return CountryStr;
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:16,代码来源:cordis.cpp

示例7: getWebsite

inline TStr getWebsite(TStr fulladdress)
{
	TStr left,right,tmp,res;
	if(fulladdress.SearchStr(TStr("http"),0)>=0)
	{
		fulladdress.SplitOnStr(left,TStr("//"),right);
		right.SplitOnCh(res,'/',tmp);
	}
	else
	{
		fulladdress.SplitOnCh(res,'/',tmp);
	}
	return res;
}
开发者ID:omid55,项目名称:memestwrepo,代码行数:14,代码来源:find_cascades_of_quotes_separately.cpp


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