本文整理汇总了C++中FSXSTRING::Mid方法的典型用法代码示例。如果您正苦于以下问题:C++ FSXSTRING::Mid方法的具体用法?C++ FSXSTRING::Mid怎么用?C++ FSXSTRING::Mid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSXSTRING
的用法示例。
在下文中一共展示了FSXSTRING::Mid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int MORF0::chknr2(MRFTULEMUSED *tulemus, FSXSTRING *S6na)
{
int res;
//int tulem = -1; //FS_Failure;
int tagasi1;
const FSxCHAR *vn;
FSXSTRING s_algus, sona, s, ss;
FSXSTRING kriips, lopp;
FSXSTRING tmpsona, vorminimi, tmplopp;
int tyyp=0, s_pik;
#define PROTSENT 2
#define KELL 3
#define ARV 4
#define NUMBER 5
#define KRAAD 6
#define KRAADC 7
#define PARAGRAHV 8
FSxCHAR vi=0;
FSXSTRING kl;
kl = FSxSTR("CFK");
s_algus = (const FSxCHAR *)(S6na->Mid(0,1));
if (s_algus == FSxSTR("+") || s_algus == FSxSTR("-"))
sona = (const FSxCHAR *)(S6na->Mid(1));
else
{
sona = *S6na;
s_algus = FSxSTR("");
}
s = (const FSxCHAR *)(sona.SpanIncluding((const FSxCHAR *)(TaheHulgad::protsendinumber)));
if (s.GetLength() != 0)
if (TaheHulgad::OnLopus(&s, FSxSTR("%")) || TaheHulgad::OnLopus(&s, FSxSTR("%-")))
tyyp = PROTSENT;
if (!tyyp)
{
// vi = s[s.GetLength()-1];
s = (const FSxCHAR *)(sona.SpanIncluding((const FSxCHAR *)(TaheHulgad::kraadinrtht)));
if (s.GetLength() != 0)
{
if (TaheHulgad::OnLopus(&s, (const FSxCHAR *)(TaheHulgad::kraad))
|| TaheHulgad::OnLopus(&s, (const FSxCHAR *)(TaheHulgad::kraadjakriips)))
tyyp = KRAAD;
else
{
if (s.GetLength() > 2)
{
vi = s[s.GetLength()-1];
if (s.Find((const FSxCHAR *)(TaheHulgad::kraad)) == s.GetLength()-2 && kl.Find(vi)!=-1)
tyyp = KRAADC;
}
}
}
}
if (!tyyp)
{
s = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::paranumber)));
if (s.GetLength() != 0)
if (TaheHulgad::OnAlguses(&s, (const FSxCHAR *)(TaheHulgad::para)))
tyyp = PARAGRAHV;
}
if (!tyyp)
{
if (sona.FindOneOf((const FSxCHAR *)(TaheHulgad::number)) == -1) // polegi numbrit kuskil...
return ALL_RIGHT;
s = (const FSxCHAR *)(sona.SpanIncluding((const FSxCHAR *)(TaheHulgad::kellanumber)));
ss = (const FSxCHAR *)(sona.SpanIncluding((const FSxCHAR *)(TaheHulgad::arv)));
if (s_algus.GetLength() == 0) // +- pole ees
{
if (s.GetLength() > ss.GetLength())
tyyp = KELL;
else if (ss.GetLength() != 0 && s.GetLength() <= ss.GetLength())
{
s = ss;
tyyp = ARV;
}
}
else // kellaajal ei tohi +- olla
{
if (ss.GetLength() !=0)
{
s = ss;
tyyp = ARV;
}
}
}
if (!tyyp) // ei saa olla...
return ALL_RIGHT;
/////
s_pik = s.GetLength();
lopp = (const FSxCHAR *)(S6na->Mid(s_pik+s_algus.GetLength()));
kriips = (const FSxCHAR *)(s.Mid(s_pik-1+s_algus.GetLength()));
if (kriips != FSxSTR("-"))
kriips = FSxSTR("");
s.TrimRight(FSxSTR("-"));
if (TaheHulgad::PoleMuudKui(&s, &(TaheHulgad::number)))
tyyp = NUMBER;
if (lopp.GetLength() == 0) // loppu pole
{
if (tyyp == NUMBER)
tulemus->Add((const FSxCHAR *)(*S6na), FSxSTR("0"), FSxSTR(""), FSxSTR("N"), FSxSTR("?, "));
//.........这里部分代码省略.........
示例2: kriips
int MORF0::chklyh3(MRFTULEMUSED *tulemus, FSXSTRING *S6na, int sygavus, int *tagasitasand)
{
int i;
int res;
FSXSTRING tmpsona, tmplopp, tmpliik, vorminimi;
//int tulem = -1; //FS_Failure;
const FSxCHAR *vn;
FSXSTRING s; // sona ise
FSXSTRING kriips(FSxSTR("")); // kriips (kui teda on)
FSXSTRING lopp; // l�pp ise
FSXSTRING ne_lopp; // line lane lopu jaoks
FSXSTRING lali; // line lane alguse jaoks
FSXSTRING ss; //
int s_pik;
int tyyp=0;
#define LYHEND 1
#define PROTSENT 2
#define KELL 3
#define PARAGRAHV 4
#define NUMBER 5
#define KRAAD 6
#define MATA 6
// if ( !ChIsUpper(*S6na) && *S6na != '%' && *S6na != para) /* ei alga suure t�hega */
// if (!TaheHulgad::OnSuur(S6na, 0) && (*S6na)[0] != (FSxCHAR)'%' && (*S6na)[0] != TaheHulgad::para[0]
if (TaheHulgad::AintSuuredjaNrjaKriipsud(S6na)) /* v�ib olla lihtsalt suuret�heline s�na */
return ALL_RIGHT; /* ei suru v�gisi l�hendiks */
s = (const FSxCHAR *)S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::protsendinumber));
if (s.GetLength() != 0)
if (TaheHulgad::OnLopus(&s, FSxSTR("%")) || TaheHulgad::OnLopus(&s, FSxSTR("%-")))
tyyp = PROTSENT;
if (!TaheHulgad::OnSuur(S6na, 0) && tyyp != PROTSENT && (*S6na)[0] != TaheHulgad::para[0] )
return ALL_RIGHT;
if (!tyyp)
{
s = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::kraadinumber)));
if (s.GetLength() != 0)
if (TaheHulgad::OnLopus(&s, (const FSxCHAR *)(TaheHulgad::kraad))
|| TaheHulgad::OnLopus(&s, (const FSxCHAR *)(TaheHulgad::kraadjakriips)) )
tyyp = KRAAD;
}
if (!tyyp)
{
s = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::paranumber)));
if (s.GetLength() != 0)
if (TaheHulgad::OnAlguses(&s, (const FSxCHAR *)(TaheHulgad::para)))
tyyp = PARAGRAHV;
}
if (!tyyp)
{
s = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::matemaatika1)));
if (s.GetLength() == 2 && TaheHulgad::OnLopus(&s, FSxSTR("-")))
tyyp = MATA;
}
if (!tyyp)
{
s = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::suurnrthtkriips)));
ss = (const FSxCHAR *)(S6na->SpanIncluding((const FSxCHAR *)(TaheHulgad::kellanumber)));
if (s.GetLength() > ss.GetLength())
tyyp = LYHEND;
else if (ss.GetLength() != 0 && s.GetLength() <= ss.GetLength())
{
s = ss;
tyyp = KELL;
}
}
if (!tyyp) // ei saa olla...
return ALL_RIGHT;
s_pik = s.GetLength();
lopp = (const FSxCHAR *)(S6na->Mid(s_pik));
if (lopp.GetLength()==0) // pole siin midagi vaadata
return ALL_RIGHT;
kriips = (const FSxCHAR *)(s.Mid(s_pik-1));
if (kriips != FSxSTR("-"))
kriips = FSxSTR("");
if (tyyp == LYHEND && kriips == FSxSTR("")) // ebakindel v�rk
{
if (s.GetLength()==1) // nt Arike
return ALL_RIGHT;
i = s.ReverseFind(FSxSTR("-"));
if (i == s.GetLength()-2)
return ALL_RIGHT; // nt CD-Romile
}
s.TrimRight(FSxSTR("-"));
if (s.GetLength()==0) // pole siin midagi vaadata
return ALL_RIGHT;
if (TaheHulgad::PoleMuudKui(&s, &TaheHulgad::number))
tyyp = NUMBER;
/* oletan, et on lyhend vm lubatud asi */
i = 1;
if (tyyp == LYHEND)
{
if(mrfFlags.Chk(MF_LYHREZH))
{
if (s.GetLength() == 1 || (!mrfFlags.Chk(MF_SPELL) && s.GetLength() < 7))
i = 1;
else
//.........这里部分代码省略.........
示例3: if
int MORF0::chkhy2(MRFTULEMUSED *tulemus, FSXSTRING *S6nna, int maxtasand, int *tagasi)
{
int i, j;
int res=0;
char rezz, rezz1;
struct lisa {
const FSxCHAR *lubatud_lopp;
const FSxCHAR *lubatud_sl;
const int mitu_eemaldada;
const FSxCHAR *otsa_panna;
} lisakatse[3] = {
{ FSxSTR("0"), FSxSTR("A"), 2, FSxSTR("ne") }, /* +ne */
{ FSxSTR("t"), FSxSTR("AS"), 0, FSxSTR("t") }, /* is+t */
{ FSxSTR("d"), FSxSTR("AS"), 0, FSxSTR("d") } }; /* +d */
int katsenr;
const FSxCHAR *lubatud_liik;
int viimane, lopus_kriips;
int tmp;
int mitu;
int sobiv_an;
CVARIANTIDE_AHEL ctoo_variandid, csobivad_variandid;
FSXSTRING S6na = *S6nna;
int k;
FSXSTRING algus;
FSXSTRING kriips;
FSXSTRING lopp;
FSXSTRING pisialgus;
MRFTULEMUSED ette;
FSXSTRING ettestr;
k = S6na.Find((FSxCHAR)'-');
if (k == -1)
k = S6na.Find((FSxCHAR)'/');
if (k == -1)
return ALL_RIGHT; // ei sisalda '-' ega '/'
algus = S6na.Left(k);
kriips = S6na.Mid(k, 1);
lopp = S6na.Mid(k+1);
if (k==0 && kriips == FSxSTR("-") ) // -sona
{
if (lopp.GetLength()<1)
return ALL_RIGHT;
res = chkwrd(tulemus, &lopp, lopp.GetLength(), maxtasand, tagasi, KOIK_LIIGID/*MITTE_VERB*/);
if (res > ALL_RIGHT)
return res; /* viga! */
if (!tulemus->on_tulem())
{
FSXSTRING pisilopp;
pisilopp = lopp;
pisilopp.MakeLower();
res = chkwrd(tulemus, &pisilopp, pisilopp.GetLength(), maxtasand, tagasi, KOIK_LIIGID);
if (res > ALL_RIGHT)
return res; /* viga! */
}
if (maxtasand < 4) // soovitaja pärast HJK 10.06.2005
return ALL_RIGHT;
if (!tulemus->on_tulem()) /* polnud -sona */
{
*tagasi = 4;
res = chklyh4(tulemus, &lopp, lopp.GetLength()); /* nt. -E */
if (res > ALL_RIGHT)
return res; /* viga! */
}
return ALL_RIGHT;
}
if (maxtasand < 4) // soovitaja p�rast HJK 10.06.2005
return ALL_RIGHT;
if (S6na.GetLength() == 2 && k == 1 && kriips == FSxSTR("-") && TaheHulgad::eestitht.Find(S6na[0])!=-1) // a-
{
tulemus->Add( (const FSxCHAR *)algus, FSxSTR("0"), FSxSTR(""), FSxSTR("Y"), FSxSTR("?, ")); /* parema puudusel */
*tagasi = 4;
return ALL_RIGHT;
}
/* sona-sona-sona-sona... */
viimane = 0;
lopus_kriips = 0;
lopp = S6na;
rezz = mrfFlags.Chk(MF_ALGV); /* algvormi rezhiimi lipp */
rezz1 = mrfFlags.Chk(MF_GENE); /* gene rezhiimi lipp */
for (mitu=0 ;; mitu++)
{
MRFTULEMUSED ajutine_tulemus;
MRFTUL t;
sobiv_an = -1;
k = lopp.Find(kriips);
if ( k==-1 ) /* viimane sonaosa */
{
algus = lopp;
lopp = FSxSTR("");
viimane = 1;
}
else
{
algus = lopp.Left(k);
lopp = lopp.Mid(k+1);
if (lopp.GetLength()==0) // viimane sonaosa; sona-
{
viimane = 1;
lopus_kriips = 1;
//.........这里部分代码省略.........
示例4: main
int main(int argc, FSTCHAR **argv)
{
CPFSFile infile; /* viit sisendfailile */
CPFSFile outf, errf; /* viidad [email protected] */
CPFSFile lgrf; /* viit lõpugruppide failile LGR*/
FSXSTRING inbuf; /* toodeldav rida */
FSXSTRING outbuf; /* toodeldav rida */
CFSFileName fn_0, fn_1, fn_2;
int total, converted, unknown;
int k;
int kk, era;
FSXSTRING inbuf_era, inbuf_para_ind;
total = converted = unknown = 0;
if (argc != 4)
{
printf("pane argumendid taha !\n");
return EXIT_FAILURE;
}
else
{
fn_0=argv[1];
fn_1=argv[2];
fn_2=argv[3];
}
if (infile.Open(fn_0, FSTSTR("rb" )) == false ||
outf.Open( fn_1, FSTSTR("wb" )) == false ||
errf.Open( fn_2, FSTSTR("wb" )) == false ||
lgrf.Open( FSTSTR("lgr"), FSTSTR("ab+")) == false)
{
printf( "Can't open files\n" );
return EXIT_FAILURE;
}
loe_lgr( &lgrf ); /* loe lõpugrupid mällu */
tyvi[0].tyv = FSxSTR("");
for (total=0; infile.ReadLine(&inbuf)==true; total++)
{
era = inbuf.Find(FSxSTR("**"));
if (era != -1)
{
tyybinr = 1; /* lihtsalt et poleks 0; vaja tee_rida() jaoks */
k = inbuf.Find(FSWSTR("!\\"));
if ( k == -1) /* polegi indeksit; ei saa olla... */
sliik = FSWSTR("V");
else
{
sliik = (const FSWCHAR *)inbuf.Mid(k+2);
k = sliik.Find(FSWSTR("\\"));
if ( k == -1)
{
printf("\nsonaliik sassis ");
return EXIT_FAILURE;
}
sliik = (const FSWCHAR *)sliik.Left(k);
}
k = verbera( &inbuf );
if (!k) /* oli mingi viga */
{
unknown++;
nullityv(); /* et saaks järgmist parad. teha */
if ((errf.WriteString((const FSxCHAR *)inbuf, inbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. error-faili ebaõnnestus");
return EXIT_FAILURE;
}
continue; /* vt järgmisi ridu */
}
converted++;
lisa_lgr( &lgrf ); /* leiab igale selle parad tyvele lgr nr */
tee_rida(&inbuf, &outbuf); /* teeb rea nr|tyvi,lgr/tyvi,lgr... */
if ((outf.WriteString((const FSxCHAR *)outbuf, outbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. väljundfaili ebaõnnestus");
return EXIT_FAILURE;
}
nullityv(); /* et saaks järgmist parad. teha */
continue; /* vt järgmist kirjet */
}
kk = inbuf.Find(FSxSTR("&&"));
inbuf_para_ind = FSxSTR("");
if (kk != -1)
inbuf_para_ind = (const FSxCHAR *)inbuf.Mid(kk);
inbuf = (const FSxCHAR *)inbuf.Left(inbuf.GetLength()-inbuf_para_ind.GetLength());
k = era_ind( &inbuf );
if (!k) /* oli mingi viga */
{
unknown++;
if ((errf.WriteString((const FSxCHAR *)inbuf, inbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. error-faili ebaõnnestus");
return EXIT_FAILURE;
}
continue; /* vt järgmisi ridu */
}
k = era_tyvi( &inbuf );
if (!k) /* oli mingi viga */
//.........这里部分代码省略.........
示例5: Tmain
int Tmain(int argc, FSTCHAR **argv)
{
CPFSFile infile; /* viit sisendfailile */
CPFSFile outf, errf; /* viidad [email protected] */
CPFSFile lgrf; /* viit lõpugruppide failile LGR*/
FSXSTRING inbuf; /* toodeldav rida */
FSXSTRING outbuf; /* toodeldav rida */
CFSFileName fn0=argv[1];
CFSFileName fn1=argv[2];
CFSFileName fn2=argv[3];
CFSFileName fn3=FSTSTR("lgr");
int total, converted, unknown;
int k;
int kk, era, k2, k3;
FSXSTRING inbuf_era, inbuf_para_ind;
converted = unknown = 0;
if (argc != 4)
{
printf("kirjuta paras arv parameetreid või keri poti laadale\n");
return EXIT_FAILURE;
}
if (infile.Open( fn0, FSTSTR("rb" )) == false ||
outf.Open( fn1, FSTSTR("wb" )) == false ||
errf.Open( fn2, FSTSTR("wb" )) == false ||
lgrf.Open( fn3, FSTSTR("ab+")) == false)
{
printf( "Can't open files\n" ); // fopen
exit( 1 );
}
loe_lgr( &lgrf ); /* loe lõpugrupid mällu */
tyvi[0].tyv = FSxSTR("");
for (total=0; infile.ReadLine(&inbuf)==true; total++)
{
kk = inbuf.Find(FSxSTR(".0!"));
if (kk!=-1) /* on 0-muuttyybi sõna */
{
tyybinr = 1; /* lihtsalt et poleks 0 */
k2 = inbuf.Find(FSxSTR("!\\"));
if (k2!=-1)
{
FSXSTRING tmp;
tmp = (const FSxCHAR *)inbuf.Mid(k2+2);
k3 = tmp.Find(FSxSTR("\\"));
if (k3!=-1)
{
sliik = (const FSxCHAR *)tmp.Left(k3);
}
}
if (k2==-1 || k3==-1)
{
unknown++;
if ((errf.WriteString((const FSxCHAR *)inbuf, inbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. error-faili ebaõnnestus");
return EXIT_FAILURE;
}
continue; /* vt järgmisi ridu */
}
k = nomnul( &inbuf );
if (!k)
{
unknown++;
if ((errf.WriteString((const FSxCHAR *)inbuf, inbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. error-faili ebaõnnestus");
return EXIT_FAILURE;
}
continue; /* vt järgmisi ridu */
}
converted++;
lisa_lgr( &lgrf ); /* leiab igale selle parad tyvele lgr nr */
tee_rida(&inbuf, &outbuf); /* teeb rea nr|tyvi,lgr/tyvi,lgr... */
if ((outf.WriteString((const FSxCHAR *)outbuf, outbuf.GetLength())) == false)
{
printf("\ntulemuse kirjut. väljundfaili ebaõnnestus");
return EXIT_FAILURE;
}
nullityv(); /* et saaks järgmist parad. teha */
continue; /* et ei vaataks nii, nagu 'norm' ridu */
}
era = inbuf.Find(FSxSTR("**"));
inbuf_era = FSxSTR("");
if (era != -1)
inbuf_era = (const FSxCHAR *)inbuf.Mid(era-1);
inbuf = (const FSxCHAR *)inbuf.Left(inbuf.GetLength()-inbuf_era.GetLength());
kk = inbuf.Find(FSxSTR("&&"));
inbuf_para_ind = FSxSTR("");
if (kk != -1)
inbuf_para_ind = (const FSxCHAR *)inbuf.Mid(kk);
inbuf = (const FSxCHAR *)inbuf.Left(inbuf.GetLength()-inbuf_para_ind.GetLength());
k = era_ind( &inbuf );
if (!k) /* oli mingi viga */
{
unknown++;
//.........这里部分代码省略.........