如何在VB.NET中比较2个几乎相同的文本框文本? [英] How can I compare 2 almost same textbox's text in VB.NET?
本文介绍了如何在VB.NET中比较2个几乎相同的文本框文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想比较它们,并在另一个文本框中显示差异。
示例:
Textbox1.Text =ABC
Textbox2.Text =AB
差异: C缺失
我尝试了什么:
我不知道,怎么开始
I'd like to compare them, and show the differences in another textbox.
Example:
Textbox1.Text = "ABC"
Textbox2.Text = "AB"
difference: "C" is missing
What I have tried:
I don't know, how to get started
推荐答案
你可以逐个字符地比较它们。创建一个新字符串,对于两个地方相同的每个字符,您可以在新字符串中添加一个点。当它们不同时,将其中一个字符放入字符串中。反之亦然。
You could compare them character by character. Create a new string and for each character that is the same in both places you could put a dot in the new string. When they are different put one of the characters in the string. Or vice versa.
这篇关于如何在VB.NET中比较2个几乎相同的文本框文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文