本文整理汇总了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;
}
示例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); }
}
}
示例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");
}
示例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;
}
示例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);
}
}