MNStringsUtils

open class MNStringsUtils

Encapsulates various utility methods used in string manipulation

Levenshtein Distance

  • Declaration

    Swift

    public struct Array2D

    Return Value

    A 2-dimensional array data structure modeled after a matrix

  • Calculates the difference between two string sequences

    Discussion: The Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions, or substitutions) required to change one word into the other. It is named after Vladimir Levenshtein, who discovered this equation in 1965.

    Declaration

    Swift

    public static func levenshtein(sourceString: String, target targetString: String) -> Int

    Parameters

    sourceString

    The string to change into targetString

    targetString

    The desired result after changing the source string

    Return Value

    The Levenshtein distance between sourceString and targetString