Skip to main content
Go to Latest
function levenshteinDistance
import { levenshteinDistance } from "https://deno.land/std@0.221.0/text/levenshtein_distance.ts";

Calculates the Levenshtein distance between two strings.

Examples

Example 1

import { levenshteinDistance } from "https://deno.land/std@0.221.0/text/levenshtein_distance.ts";
levenshteinDistance("aa", "bb"); // 2

Parameters

str1: string
  • The first string.
str2: string
  • The second string.

Returns

number

The Levenshtein distance between the two strings.