/// <summary> /// <para>toWord为真时,适合英文,将以单词为一个单位做比较,为false,将每个字符做比较,适合无html代码的纯中文</para> /// <para>请在Web显示输出时加入2个样式,参考:http://www.rohland.co.za/index.php/2009/10/31/csharp-html-diff-algorithm/ </para> /// </summary> /// <param name="oldText"></param> /// <param name="newText"></param> /// <param name="toWord"></param> /// <returns></returns> public static string Build(string oldText, string newText, bool toWord = false) { HtmlDiff diffHelper = new HtmlDiff(oldText ?? string.Empty, newText ?? string.Empty, toWord); return(diffHelper.Build()); }
/// <summary> /// <para>toWord为真时,适合英文,将以单词为一个单位做比较,为false,将每个字符做比较,适合无html代码的纯中文</para> /// <para>请在Web显示输出时加入2个样式,参考:http://www.rohland.co.za/index.php/2009/10/31/csharp-html-diff-algorithm/ </para> /// </summary> /// <param name="oldText"></param> /// <param name="newText"></param> /// <param name="toWord"></param> /// <returns></returns> public static string Build(string oldText, string newText, bool toWord = false) { HtmlDiff diffHelper = new HtmlDiff(oldText ?? string.Empty, newText ?? string.Empty, toWord); return diffHelper.Build(); }