Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/text/mod.ts>levenshteinDistance

The Deno Standard Library
Latest
function levenshteinDistance
Re-export
import { levenshteinDistance } from "https://deno.land/std@0.224.0/text/mod.ts";

Calculates the Levenshtein distance between two strings.

Examples

Example 1

import { levenshteinDistance } from "https://deno.land/std@0.224.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.