lua.wetgenes.txt.diff
(C) 2020 Kriss Blank and released under the MIT license, see http://opensource.org/licenses/MIT for full license text.
local wtxtdiff=require("wetgenes.txt.diff")
lua.wetgenes.txt.diff.find
Given two tables of strings, return the length , starta , startb of the longest common subsequence in table indexes or nil if not similar.
lua.wetgenes.txt.diff.match
Given two tables of strings, return two tables of strings of the same length where as many strings as possible match.
lua.wetgenes.txt.diff.split
Use the delimiter to split a string into a table of strings such that each string ends in the delimiter (except for possibly the final string) and a table.concat on the result will recreate the input string exactly.
table = wtxtdiff.split(string,delimiter)
String is the string to split and delimiter is a lua pattern so any special chars should be escaped.
for example
st = wtxtdiff.split(s) -- split on newline (default)
st = wtxtdiff.split(s,"\n") -- split on newline (explicit)
st - wtxtdiff.split(s,"%s+") -- split on white space
lua.wetgenes.txt.diff.trim
Given two tables of strings, return the length at the start and at the end that are the same. This tends to be a good first step when comparing two chunks of text.