Latest 1.0.0
Homepage https://github.com/shivbaijal/DiceCoefficient
License MIT
Platforms ios 8.0, tvos 9.0, requires ARC
Authors

Calculate the similarity of strings using the Sørensen–Dice coefficient.

Usage

String+DiceCoefficient

diceCoefficient(otherString: String)

Returns a Float from 0 to 1, where 1 indicates strings are (case insensitively) identical

let stringOne = "croquet"
stringOne.diceCoefficient("tekken") // -> 0.0
stringOne.diceCoefficient("criques") // -> 0.5
stringOne.diceCoefficient("croquet") // -> 1.0

Installation

CocoaPods

DiceCoefficient is available using CocoaPods. Add the following line to your Podfile:

pod "DiceCoefficient"

Swift Package Manager

DiceCoefficient is available using Swift Package Manager.
Add the following in your Package.swift:

import PackageDescription

let package = Package(
    name: "CoolestAppEver",
    dependencies: [
        .Package(url: "https://github.com/shivbaijal/DiceCoefficient.git", majorVersion: 0)
    ]
)

Carthage

DiceCoefficient is not yet available using Carthage, but it will be soon!

Manual

You can simply add the DiceCoefficient.swift file to your Xcode project.

More Info About The Sørensen–Dice Coefficient

License

DiceCoefficient is available under the MIT license, see the LICENSE file for more info.

Latest podspec

{
    "name": "DiceCoefficient",
    "version": "1.0.0",
    "summary": "Calculate the similarity of strings using the Su00f8rensenu2013Dice coefficient",
    "license": "MIT",
    "homepage": "https://github.com/shivbaijal/DiceCoefficient",
    "authors": {
        "Shiv Baijal": "[email protected]"
    },
    "source": {
        "git": "https://github.com/shivbaijal/DiceCoefficient.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This