Go to file
wzxjiang 4f19826a8d update utf8.count to count 2018-05-24 12:15:29 +08:00
Sdifft.xcodeproj rename Diff 2018-05-23 20:33:05 +08:00
Sources/Sdifft update utf8.count to count 2018-05-24 12:15:29 +08:00
Tests rename Diff 2018-05-23 20:33:05 +08:00
.gitignore update .gitignore 2018-05-23 17:15:35 +08:00
.travis.yml Update .travis.yml 2018-05-24 11:08:25 +08:00
LICENSE Initial commit 2018-04-03 18:11:56 +08:00
Package.swift rename Diff 2018-05-23 20:33:05 +08:00
README.md Update README.md 2018-05-24 10:32:58 +08:00
codecov.yml Update codecov.yml 2018-05-24 10:57:12 +08:00

README.md

Sdifft

swift version travis-ci codecov codebeat badge

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.