Skip to content

Commit c2a4a09

Browse files
authored
Update README.md
1 parent 4ee0fd9 commit c2a4a09

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# stringdiff
2-
A java application that highlights text differences between two plain strings by generating html fragment to show changes
1+
# StringDiff
2+
This java application highlights text differences between two plain strings by generating html fragment to show changes
3+
The buildLcsList() method finds longest substrings common to both text1 and text2 recursively producing a list of longest common substrings used in markTextDiff() to markup changes between text1 and text2.
4+
Java 8 or later is required to run the application.
5+
6+
# Compile
7+
Run following command to build the application:
8+
```
9+
javac lcs\StringDiff.java
10+
```
11+
12+
# Run
13+
Just use the following command to run the application:
14+
```
15+
java lcs.StringDiff
16+
```
17+
18+
# Example
19+
20+
```
21+
text1 = "Do not change this section. Please check any misqelling! Note that this section is obsolete.";
22+
text2 = "New section added. Do not change this section. Please check any mispelling!";
23+
24+
Running the application with command "java lcs.StringDiff":
25+
26+
<ins style='background-color:#00ff66'>New section added. </ins>Do not change this section. Please check any mis<del style='background-color:#ff9933'>q</del><ins style='background-color:#00ff66'>p</ins>elling!<del style='background-color:#ff9933'> Note that this section is obsolete.</del>
27+
```
28+
If you load the html fragment with a browser, you get the following result:
29+
30+
31+
# Credits
32+
The longest common substrings are found using the LongestCommonSubstring (LCS) algorithm credited to https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/LongestCommonSubstring.java.html
33+
Credits go to Robert Sedgewick and Kevin Wayne that provide the LCS algorithm with GNU General Public License

0 commit comments

Comments
 (0)