Skip to content
Reference > Methods

strDistanceLev(left,right,ignoreCase)

Definition

Integer strDistanceLev(String left, String right, Boolean ignoreCase)

Description

Return the levenshtein distance between two strings. This is naturally a case insensitve comparison.

Parameter Definition

Name Type Description
left String The First string to text
right String The Second string to text
ignoreCase Boolean Ignore case when calculating distance

Examples

1
2
3
4
5
6
7
Integer r1 = strDistanceLev("FEATHER","FEATHER",true); // r1 == 0
Integer r2 = strDistanceLev("FEATHER","Farther",true); // r2 == 2
Integer r3 = strDistanceLev("FEATHER","Farther",false); // r3 == 6
Integer r4 = strDistanceLev("Color","flower",true); // r4 == 4
Integer r5 = strDistanceLev("Some one","Some thing",true); // r5 == 4
Integer r6 = strDistanceLev(null,null,true); // r6 == 0
Integer r7 = strDistanceLev(null,"I",true); // r7 == 1