Home > Back-end >  RichEdit compared with character of Memo controls
RichEdit compared with character of Memo controls

Time:10-22

Void __fastcall Tyingwendazi: : RichEdit1Change (TObject * Sender)
{
Static int m=0, n=1;//m is the number of rows sorted; N is each sort of the characters
Char a, [10].
String st2=RichEdit1 - & gt; The Text;//this is to have input,
String S=st2. SubString (st2. Length (), 1);//the last character
Strcpy (a, S.c _str ());//the string into a character type char
Char I=a, [0].
If (I=='\ n')
{
M++;
N=1;
return;
}



If (I==Memo1 - & gt; Lines - & gt; Strings [m] [n])
{
RichEdit1 - & gt; SelStart=st2. Length () - 1;
RichEdit1 - & gt; SelLength=1;
RichEdit1 - & gt; SelAttributes - & gt; Color=clBlack;
RichEdit1 - & gt; SelLength=0;
RichEdit1 - & gt; SelStart=st2. Length ();
}
The else
{
RichEdit1 - & gt; SelStart=st2. Length () - 1;
RichEdit1 - & gt; SelLength=1;
RichEdit1 - & gt; SelAttributes - & gt; Color=clRed;
RichEdit1 - & gt; SelLength=0;
RichEdit1 - & gt; SelStart=st2. Length ();
}
N++;
I wrote a piece of code, the realization of select RichEdit1 last character compared with the corresponding character Memo1, same show black and red different functions,
I don't have change to go to, achieve the final comparison of two characters (in fact is the realization of a Chinese character contrast)
I don't have big, can do to help?

CodePudding user response:

Chinese characters are the two bytes
  • Related