---
schema_version: "1"
id: abc7e90b1f13d7a7cc316833594d8acd166bc94907c62d9c56600fef424338bf
title: levenshteinDistance
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-strings-functions-levenshteindistance.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-strings-functions-levenshteindistance
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8f38fe89195f8e0075ee53d86c7e74ccfb10711a286762789e00c13db8a63f31
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# levenshteinDistance

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## levenshteinDistance(a: String, b: String): Number

Returns the Levenshtein distance (or edit distance) between two strings.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>a</code></p></td><td><p>The first string.</p></td></tr><tr><td><p><code>b</code></p></td><td><p>The second string.</p></td></tr></tbody></table>

### Example

This example shows how `levenshteinDistance` behaves with different strings.

#### Source

```DataWeave
%dw 2.0
import levenshteinDistance from dw::core::Strings
output application/json
---
"kitten" levenshteinDistance "sitting"
```

#### Output

```Json
3
```
