我比较richTextBox1和richTextBox2逐字。比较两个RichTextBox?
// collect words from ritchtextbox1
String[] test = richtextbox1.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
// find each word test to richtextbox2
// if it is found then change back color of particular word to green of the
// else change back color of particular word to red in richtextbox1
test = richtextbox2.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
// find each word in test to richtextbox1
// if it is found then change back color of particular word to green of the
// else change back color of particular word to red in richtextbox2
任何一个可以帮助我的代码我在语法有点差。的mateusz代码
IM服用参考
String[] test = richtextbox1.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
String[] test2 = richtextbox2.text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
bool wordNotFound=false;
for (int i=0;i<test.lenght;i++)
for (int j=0;j<test2.length;j++){
if (test[i].equals(test2[j])){
wordNotFound=true
break;
}
else wordNotFound=true;
}
////在这里,我需要改变特定的背单词的颜色不是整个ritchtextbox
if (wordNotFound) richTextBox1.BackColor = Color.Red;
else richTextBox1.BackColor = Color.Green;
我不是比较两个文本框,即时通讯验证双方存在或不存在的每个单词。就像拼写检查词典一样richtextbox1。在richtextbox2中拼写检查[有效的单词]。反之亦然......
即时验证每个存在于双方的单词。就像拼写检查词典一样richtextbox1。在richtextbox2中拼写检查[有效的单词]。反之亦然... – Siva
[如何使用C#比较两个richtextbox文本](http:// stackoverflow。com/questions/6782195/how-to-compare-two-richtextbox-text-using-c-sharp) – 2012-12-12 13:29:17
@ 0A0D其逐行比较我需要逐字比较 – Siva