I have two variables each holding a string of data. The string may be a simple short sentence of text, it may be several paragraphs of text.
Call one "Original", and the other "Modified"
The "Modified" string is a modified version of the the "Original".
On my ASP page I need to show both strings side by side, that's no problem! However to aid my users in finding the modifications I want to highlight using a background color or font color where the modified string differs from the original.
I was just wondering if anyone had tackled anything like this before?
I would really appreciate any help you could give me.
Nice thinking. Buth what happens if a user just inserts one space to many in one of the strings ?
If you get an empty cell in your array, all the following words won't match, and it might not be very clear for the user what the difference was.
I don't think their is an easy sollution here. You'll probaby have to run more then one routine here. (perhaps depending on the length of the string)
if Len(string1) < 20 then
if Len(string1) < 50 then
I think i got it sorta going where whammy suggested but there is some recursive error.
Dim String1, String2
String1 = Request.Form("String1")
String2 = Request.Form("String2")
If String1 <> "" And String2 <> "" Then
Dim x, y, temp
x = 1
y = 1
'Seperate the first sentence into a string
temp = InStr(x, String1, " ", vbTextCompare)
If temp = 0 Then Exit Do
Words1(y) = Mid(String1, x, temp - 1)
x = temp + 1
y = y + 1
Loop Until x = Len(String1)
temp = ""
For z = 1 To y
temp = temp & Words1(z) & vbCrLf
<p><FORM action="" Method="POST">
<INPUT type="text" name="String1">
<INPUT type="text" name="String2">
<INPUT type="Submit" value="Compare">
Perhaps someone can see whats wrong with it. Try the code out and you'll see the problem.