levenshtein_distance
The Levenshtein edit distance between a and b: the fewest single-character insertions,
deletions or substitutions needed to turn one into the other.
Operates on chars (Unicode scalar values), not bytes or grapheme clusters.
Import
Section titled “Import”Cargo feature string (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | &str | The first string. |
b | &str | The second string. |
case_sensitive | bool | Whether the comparison is case-sensitive. |
Returns
Section titled “Returns”usize — The edit distance; 0 when a and b are equal (after case-folding when case_sensitive
is false).
