Text.LevenshteinDistance
------------------------

Calculates the string distance.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [2.9](newinversion29.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.LevenshteinDistance"; a; b ) 

**MBS**( **"Text.LevenshteinDistance";** /\* Calculates the string distance. \*/  
**$a**; /\* First text string.e.g. "Hello" \*/   
**$b**) /\* Second text string.e.g. "Hallo" \*/ 

(old name: String.LevenshteinDistance)

### Parameters

| Parameter | Description | Example |
|---|---|---|
| a | First text string. | "Hello" |
| b | Second text string. | "Hallo" |

### Result

Returns difference.

### Description

Calculates the string distance.  
Value is normalized, so 0.0 is equal text and 1.0 is totally unequal, but value can be higher than 1.0 if text length is very different.  
  
see also  
[http://en.wikipedia.org/wiki/Levenshtein\_distance](http://en.wikipedia.org/wiki/Levenshtein_distance)  
### Examples

Calculate difference between two strings:

 MBS ( "Text.LevenshteinDistance"; "Hello"; "Hallo" )  
<small>  
Example result: 0.2</small>### See also

- [GMImage.Hash](GMImageHash.md)
- [List.BestMatch](ListBestMatch.md)
- [QuickList.BestMatch](QuickListBestMatch.md)

This function checks for a license.

Created 18th August 2014 , last changed 13th June 2024

  
[Text.Length](TextLength.md) - [Text.List](TextList.md)

[HTML Version](TextLevenshteinDistance.shtml)