Skip to main content
Module

x/cliffy/prompt/deps.ts>levenshteinDistance

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Latest
function levenshteinDistance
import { levenshteinDistance } from "https://deno.land/x/cliffy@v1.0.0-rc.4/prompt/deps.ts";

Calculates the Levenshtein distance between two strings.

Examples

Example 1

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