使用vb.net分割合并的文件 [英] splitting the merged file using vb.net

查看:167
本文介绍了使用vb.net分割合并的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下格式的合并文档文件,
[filename1.doc]
....
....
.....
[/filename1.doc]

[filename2.doc]
....
....
.....
[/filename2.doc]
[filename3.doc]
....
....
.....
[/filename3.doc]

现在我需要分割三个文档文件并使用vb.net编码将其保存为相同的filename.doc

i am having a merged document file in the below format,
[filename1.doc]
....
....
.....
[/filename1.doc]

[filename2.doc]
....
....
.....
[/filename2.doc]
[filename3.doc]
....
....
.....
[/filename3.doc]

now i need to split the three document files and save it with the same filename.doc using vb.net coding

推荐答案

只需检查以下链接即可.您解决您的问题

如何拆分和合并两个文件
Just Check out the following link.It will help you to Solve your problem

How to Split and Merge Two Files


您显然在做一些错误的发展.我记得你以前的问题.首先,您想合并文件,但在此问题上有问题,而不是想将它们拆分回去,那么为什么要合并它们呢?您不必解释原因.相反,请尝试帮自己一个忙:停止这项无用的活动,并忙于有意义的事情.例如,学习一些编程,您确实需要它.

—SA
You are apparently doing some development along the wrong lines. I remember your previous questions. First you wanted to merge files and had problem with this matter, not you want to split them back, so why merging them? You don''t have to explain why. Instead, try to do yourself a great favor: stop this useless activity and get busy with something meaningful. For example, learn some programming, you really need it.

—SA


最简单的方法可能是使用正则表达式:
The simplest way is probably to use a regex:
Dim regex As New Regex("\[(?<filename>[^\]]*)\](?<text>.*)\[/\k<filename>\]", RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.Singleline Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
Dim ms As MatchCollection = regex.Matches(InputText)</filename></text></filename>

这会将每个文件捕获为一个单独的匹配项,每个文件分为两组:文件名"和文本".

This captures each file into a separate match, each with two groups: "Filename" and "Text".


这篇关于使用vb.net分割合并的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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