一、新建项目:StringSimilarityDemo
<ItemGroup> <PackageReference Include="F23.StringSimilarity" Version="4.1.0" /> </ItemGroup>
二、Program.cs
using F23.StringSimilarity; using System; namespace StringSimilarityDemo { class Program { static void Main(string[] args) { //Jaro-Winkler var jw = new JaroWinkler(); // substitution of s and t Console.WriteLine(jw.Similarity("My string", "My tsring")); // substitution of s and n Console.WriteLine(jw.Similarity("My string", "My ntrisg")); } } }
运行效果: