如何在C#中进行文本合并 [英] How to make a text merger in c#

查看:82
本文介绍了如何在C#中进行文本合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个程序,其功能之一是可以合并文本文件.

您将如何合并两个文本字符串?另外,如何列出两个文本字符串之间的差异?

I''m attempting to make a program that as one of its features can merge text files.

How would you go about merging two strings of text? Also, How might you list the differences between two text strings?

推荐答案

要合并文件,可以使用FileInfo.AppendTextFile.AppendText,在帮助中查找它们或MSDN,那里有示例.

对于差异,请使用 C#差异算法 [
For merging the files you can use FileInfo.AppendText or File.AppendText, look them up in help or MSDN, there are examples there.

For the differences, Difference Algorithm for C#[^] should give you enough to make an attempt.


不确定如果不愿意链接到您自己的文章,请参阅:

http://www.codeproject.com/KB/files/CsLCSDiff.aspx [ ^ ]

这是C#的基于LCS的差异类.您可以将其用作基础,然后添加合并支持.
Not sure if it''s frowned upon to link to your own articles, but see:

http://www.codeproject.com/KB/files/CsLCSDiff.aspx[^]

It''s an LCS based diffing class for C#. You can use that as a base and then add merge support.


请参阅 ^ ].


这篇关于如何在C#中进行文本合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆