![]() |
||
---|---|---|
Sdifft.xcodeproj | ||
Sources/Sdifft | ||
Tests | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
Package.swift | ||
README.md | ||
codecov.yml |
README.md
Sdifft
Using the LCS to compare differences between two strings
Example
impoort Sdifft
let to = "abcd"
let from = "b"
let diff = Diff(from: from, to: to)
diff.modification.add // [0...0, 2...3]
diff.modification.delete // []
diff.modification.same // [1...1]
let to = "abcd"
let from = "bx"
let diff = Diff(from: from, to: to)
diff.modification.add // [0...0, 2...3]
diff.modification.delete // [1...1]
diff.modification.same // [1...1]
Installation
Swift Package Manager
// Package.swift
let package = Package(
name: "XXX",
dependencies: [
.Package(url: "https://github.com/Wzxhaha/Sdifft", majorVersion: 1)
]
)
Carthage
// Cartfile
github "Wzxhaha/Sdifft"
License
Sdifft is released under the MIT license. See LICENSE for details.