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


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

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


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

示例1: LoadVoc

PLwOnto TLwOnto::LoadVoc(const TStr& FNm) {
  // create ontology
  PLwOnto LwOnto = TLwOnto::New();
  // create language object
  int EnLangId = LwOnto->GetLangBs()->AddLang("EN", "English");
  // create term-types
  PLwTermType TermType = TLwTermType::New(0, "Term", EnLangId);
  LwOnto->GetTermTypeBs()->AddTermType(TermType);
  // create terms
  {printf("Creating terms ...\n");
  // load terms from file
  TStr VocFileStr = TStr::LoadTxt(FNm); 
  VocFileStr.DelChAll('\r');
  TStrV TermNmV; VocFileStr.SplitOnAllCh('\n', TermNmV);
  // add terms to base
  const int Terms = TermNmV.Len();
  for (int TermId = 0; TermId<Terms; TermId++){
    if (TermId%1000==0){printf("%d/%d\r", TermId, Terms);}
    TStr TermNm = TermNmV[TermId];
    // create term
    PLwTerm Term=TLwTerm::New(TermId, TermNm, EnLangId, TermType->GetTermTypeId());
    LwOnto->GetTermBs()->AddTerm(Term);
  }
  printf("Done. (%d)\n", LwOnto->GetTermBs()->GetTerms());}
  // return ontology
  return LwOnto;
}
开发者ID:Accio,项目名称:snap,代码行数:27,代码来源:ontolight.cpp

示例2: LoadFromFile

void TSwSet::LoadFromFile(const TStr& FNm) {
    TStr FileStr = TStr::LoadTxt(FNm);
    FileStr.DelChAll('\r');
    TStrV WordV; FileStr.SplitOnAllCh('\n', WordV);
    for (int WordN = 0; WordN < WordV.Len(); WordN++) {
        const TStr& WordStr = WordV[WordN];
        if (!IsIn(WordStr)) { AddWord(WordStr); }
    }
}
开发者ID:edgeflip,项目名称:dmoz,代码行数:9,代码来源:stopword.cpp

示例3:

TEST(TStr, Del) {
	TStr Str = "aabbaabb";
	TStr Empty = "";
	
	TStr Test = Str;
	Test.DelChAll('a');
	EXPECT_EQ(Test, "bbbb");
	Test.DelChAll('c');
	EXPECT_EQ(Test, "bbbb");
	
	Test = Str;
	Test.DelSubStr(2, 3);
	EXPECT_EQ(Test, "aaaabb");
	
	Test.DelSubStr(0, 1);
	EXPECT_EQ(Test, "aabb");
	Test.DelSubStr(2, 3);
	EXPECT_EQ(Test, "aa");
	
	EXPECT_ANY_THROW(Test.DelSubStr(-1, 5));
	
	Test.DelSubStr(0, 1);
	EXPECT_EQ(Test, "");
	Test = Str;
	Test.DelSubStr(0, 0);
	EXPECT_EQ(Test, "abbaabb");
	

	Test = Str;
	EXPECT_TRUE(Test.DelStr("ab"));
	EXPECT_EQ(Test, "abaabb");
	EXPECT_FALSE(Test.DelStr("fs"));
	EXPECT_EQ(Test, "abaabb");

	Test = Str;
	EXPECT_EQ(2, Test.DelStrAll("ab"));
	EXPECT_EQ(Test, "abab");
}
开发者ID:gitter-badger,项目名称:qminer,代码行数:38,代码来源:test-TStr.cpp

示例4: 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

示例5: PaintMgGlass

void TVizMapContext::PaintMgGlass(PGks Gks, const int& KeyWdFontSize) {
    // drawing the dark circle
    TFltRect ZoomRect = GetZoomRect();
    int SizeX = TFlt::Round((MgGlassSize/ZoomRect.GetXLen()) * Gks->GetWidth());
    int SizeY = TFlt::Round((MgGlassSize/ZoomRect.GetYLen()) * Gks->GetHeight());
    Gks->SetBrush(TGksBrush::New(ColorMgGlass));
    Gks->FillEllipse(ScreenX-SizeX, ScreenY-SizeY, ScreenX+SizeX, ScreenY+SizeY);
    // drawing the keywords
    if (MgGlassKeyWdV.Len() > 0) {
        // prepare the string
        Gks->SetFont(TGksFont::New("ARIAL", KeyWdFontSize, TGksColor::GetBlack(), TFSet()|gfsBold));
        TStr KeyWdStr = Gks->BreakTxt(MgGlassKeyWdV, ", ", ",", MgGlassWindowWidth);       
        TStr NearPointStr;
        if (NearPointN != -1) {
            PVizMapPoint NearPoint = VizMapFrame->GetPoint(NearPointN);
            if (NearPoint->IsPointNm()) {
                TStr NearPointNm = NearPoint->GetPointNm();
                if (NearPointNm.IsStrIn("[[")) {
                    const int StartPos = NearPointNm.SearchStr("[[");
                    NearPointNm = NearPointNm.Left(StartPos - 1);
                }
                NearPointStr = Gks->BreakTxt(NearPointNm, 
                    " ", "", MgGlassWindowWidth, 1);
                NearPointStr.DelChAll('\n');
                NearPointStr += "\n";
            }
        }
        TStr DocCountStr = "#documents = " + MgGlassPoints.GetStr() + "\n";
        // compose the final message
        KeyWdStr = NearPointStr + DocCountStr + KeyWdStr;
        // find position of the window
        int WndWidth = Gks->GetTxtWidth(KeyWdStr) + 6;
        int WndHeight = Gks->GetTxtHeight(KeyWdStr) + 6;
        int PosX = ScreenX + 20, PosY = ScreenY + 20;
        if (PosX + WndWidth > Gks->GetWidth()) {
            PosX = ScreenX - 20 - WndWidth; }
        if (PosY + WndHeight > Gks->GetHeight()) {
            PosY = ScreenY - 20 - WndHeight; }
        // draw the keyword string
        Gks->SetBrush(TGksBrush::New(ColorMgGlassWndShadow));
        Gks->FillRect(PosX + 5, PosY + 5, 
            PosX + WndWidth + 5, PosY + WndHeight + 5);
        Gks->SetBrush(TGksBrush::New(ColorMgGlassWnd));
        Gks->SetPen(TGksPen::New(ColorMgGlassWndFrm));
        Gks->Rectangle(PosX, PosY, 
            PosX + WndWidth, PosY + WndHeight);
        Gks->PutTxt(KeyWdStr, PosX+3, PosY+3);
    }
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:49,代码来源:vizmapgks.cpp


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