Swift Package Index


Swdifft is string diff library of longest common subsequence.


  • The latest stable release is 1.0.3. Released over 1 year ago.
  • The last commit to master was over 1 year ago.

Swift Version Compatibility

  • 1.0.3 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 1.0.3 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

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.