/** * @author lautturi.com * Java example: Java compare two strings, return the alike degree with the percentage. */ import java.util.*; import org.apache.commons.lang3.StringUtils; // compare two string in java result in percentage public class Lautturi { @SuppressWarnings("deprecation") public static void main(String[] args) { String str1 = "Hello Java World"; String str2 = "Hello java world"; double distance = StringUtils.getJaroWinklerDistance(str1, str2); System.out.println(distance); } }
output:
0.95