Basically I have two strings. Both strings will contain similar data because the 2nd string is the first string after an update of the first string takes place. Both strings are returned in my Stored Procedure
For example:
String1 = "Here is some data. lets type some more data"
String2 = "Here's some data. Lets type some data here"
I would want to change string2 (inside my Stored Procedure) to show the changed/added text highlighted and the deleted text with a strike though.
So I would want string2 to look like this
string2 = "Here<font color = \"#00FF00\">'s</font> <strike>is</strike> some data. <font color = \"#00FF00\">L</font>ets type some <strike>more</strike> data <font color = \"#00FF00\">here</font>"
Is there an way to accomplish this inside a stored procedure?
First, you'll have to decide what algorithm determines what matches and what is different. For example, if you just compare the strings by the same position, you'll get the first part the same, the end of the first string as deleted and the end of the second string as inserted. I don't know how to implement the algorithm but I can think of some possibilities:
1. Regular expressions may have some support for this.
2. Track the user's changes character by character on the client.
3. Find a differencing algorithm / tool somewhere.
Once you've solved that, I suggest you pass the difference string to your procedure. You'll have much more flexibility and support in .NET than in SQL.
Sorry I couldn't help more. Good Luck.
|||Yes, you can. However, that is best left up to an application as it's a matter of presentation and application logic.
No comments:
Post a Comment