https://github.com/bannzai/swdifft
Swdifft is string diff library of longest common subsequence.
https://github.com/bannzai/swdifft
Last synced: 3 months ago
JSON representation
Swdifft is string diff library of longest common subsequence.
- Host: GitHub
- URL: https://github.com/bannzai/swdifft
- Owner: bannzai
- License: mit
- Created: 2019-07-13T04:14:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-16T14:05:14.000Z (almost 7 years ago)
- Last Synced: 2024-10-28T17:53:27.523Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 20.5 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swdifft
**Swdifft** is string diff library of longest common subsequence.
## Usage
Using diff function, **Swdifft** marked diff between left and right.
```swift
let result = diff("ABCDEFGHIJ", "ABCDEFG")
print(result.lhs) // ABCDEFG`HIJ`
print(result.rhs) // ABCDEFG
```
If it reversed.
```swift
let result = diff("ABCDEFG", "ABCDEFGHIJ")
print(result.lhs) // ABCDEFG
print(result.rhs) // ABCDEFG*HIJ*
```
And it can be print diff.
```swift
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.
```swift
beginLHSMark = "%" // Default is `
endLHSMark = "%" // Default is `
beginRHSMark = "&" // Default is *
endRHSMark = "&" // Default is *
```
# LICENSE
[Swdifft](https://github.com/bannzai/Swdifft/) is released under the MIT license. See [LICENSE](https://github.com/bannzai/Swdifft/blob/master/LICENSE.txt) for details.