Skip to content

bannzai/Swdifft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swdifft

Swdifft is string diff library of longest common subsequence.

Usage

Using diff function, Swdifft marked diff between left and right.

let result = diff("ABCDEFGHIJ", "ABCDEFG")
print(result.lhs) // ABCDEFG`HIJ`
print(result.rhs) // ABCDEFG

If it reversed.

let result = diff("ABCDEFG", "ABCDEFGHIJ")
print(result.lhs) // ABCDEFG
print(result.rhs) // ABCDEFG*HIJ*

And it can be print diff.

printDiff("ABCDEFGHIJ", "ABCDEFG") 

Result.

ABCDEFG`HIJ`
ABCDEFG

Swdifft marked symbol's, when string matches the difference. The mark can customize from default setting to use these global variables.

beginLHSMark = "%" // Default is `
endLHSMark = "%" // Default is `
beginRHSMark = "&" // Default is *
endRHSMark = "&" // Default is *

LICENSE

Swdifft is released under the MIT license. See LICENSE for details.

About

Swdifft is string diff library of longest common subsequence.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages