|
在很多情况下都要识别汉字,以下是函数 VString
1 R4 L. q9 w0 e$ IAnsiString __fastcall TForm1::VString(AnsiString ss)
& t6 I3 [8 E/ e9 J+ ^( Q { # V" K% }1 \; V8 S1 w( f
AnsiString ass;
$ J0 Y# h. n6 X1 j int ii,ll;
+ r3 P% B, s; w% X+ \ _ unsigned char cc; " V3 V; p, W" @% R+ c
ass=""; + u9 _- h" x* k! t6 l* I. V/ H; b2 d
ll=ss.Length(); ) ]! t. n' T- t) ]$ I
for(ii=0;ii<ll;ii++) 4 {( W2 b; Z; k1 A3 V* w$ }
{ 0 Y+ |5 L2 I* ]. [$ z; C
cc=ss.c_str()[ii];
$ u( ]! l; ?# t if(cc>0xa0)
J w* J7 M2 ] {
0 S" \1 E0 c* G+ C% I6 v0 ~5 s ass=ass+ss.SubString(ii+1,2); P1 l/ e+ \; V- |+ ]! s* B5 n- \ U
i++;
$ P3 ]. Y9 |( \, ~4 k' H } 0 o/ C; m8 C0 p
else 2 d& x/ B) X9 t( L9 `
{
7 ^% h. [& h9 L ass=ass+ss.SubString(ii+1,1);
/ c& M$ S: s8 ^" R, a% G0 {1 l) i
}
2 o$ T% P- w' ?! s }
2 }" \2 v5 S" i/ A$ }; g' J- c return ass; 3 a3 z1 v" J ^
} |