use of com.github.difflib.text.DiffRow in project page-factory-2 by sbtqa.
the class DiffUtils method diff.
public static String diff(String string1, String string2) {
DiffRowGenerator generator = DiffRowGenerator.create().showInlineDiffs(true).mergeOriginalRevised(true).oldTag(f -> "|").newTag(f -> "|").build();
List<DiffRow> rows = new ArrayList<>();
try {
rows = generator.generateDiffRows(Collections.singletonList(string1), Collections.singletonList(string2));
} catch (DiffException e) {
LOG.info("There is an error in string diff", e);
}
return !rows.isEmpty() ? rows.get(0).getOldLine() : "";
}
Aggregations