帮助使用制表符分隔文件 [英] Help With Tab Delimited File

查看:94
本文介绍了帮助使用制表符分隔文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一些专家建议。我在VB6写作。我打开一个制表符分隔文件,删除前50行,并将文件重写为临时文件。临时文件有大约20列,x行数。我想要做的是打开制表符分隔文件,并将每列读入一个命名变量ex。深度< COLUMN1> MPF<列2> TG<栏3>等。我编写了一个函数来从column2(mpf)&获取变量。在column2创建另一个变量(fph)以插回文件。这将从列2(mpf)开始向上移动一列。列和变量如下:

深度(column1),mpf(column2),tg(column3),c1(column4)等。与变量。我需要创建变量fph并将其插入column2,其中新文件将如下所示:

深度(column1),fph(column2),mpf(column3),tg(第4列) ,c1(column5)等到行尾。我的代码如下:

展开 | 选择 | Wrap | 行号

解决方案

这应该更快更容易阅读。 ..

展开 | 选择 | Wrap | 行号


感谢您的回复。这段代码没有将制表符分隔文件重新组合在一起,我有一个函数,第二列中的数据需要运行,从而为另一个变量和数据列创建数据。将文件写入临时文件后,需要将此新数据列插入第一列后面。那有意义吗?如果我可以将每列数据放入某个变量中,与每列相关,那么我相信通过该函数运行命名变量会更容易,并且该值存储在另一个变量中,并插入到选项卡中的临时文件中分隔的文本文件。 ?不确定,但我认为逻辑可行。我在创建它时遇到问题。这有意义吗?


好的,然后......我在哪里要插入的项目是你将函数返回一个字符串的地方我认为你说它从第二个colume做它的事情所以它会...

展开 | 选择 | Wrap | 行号

I would like some expert advice. I am writing in VB6. I am opening a tab delimited file, deleting the first 50 lines, and rewriting the file to a temp file. The temp file has about 20 columns with x number of lines. What I am trying to do, is open the tab delimited file, and read each column into a named variable, ex. depth<column1>mpf<column2>tg<column3>,etc. I have written a function to take the variable from column2(mpf) & create another variable(fph) to insert back into the file, at column2. This would move everything from column2(mpf) on, up one column. The columns and variables are as follows:
depth(column1),mpf(column2),tg(column3),c1(column4 ),etc. with the variables. I need to create the variable fph and insert it into column2, where the new file will read as follows:
depth(column1),fph(column2),mpf(column3),tg(column 4),c1(column5),etc to the end of the line. The code I have is as follows:

Expand|Select|Wrap|Line Numbers

解决方案

This should be faster and easier to read...

Expand|Select|Wrap|Line Numbers


Thanks for the response. This code is not putting the tab delimited file back together, and I have a function that the data in the second column, needs to run through, thus creating data for another variable and column of data. This new column of data needs to be inserted behind the first column, once the file is being written to the temp file. Does that make sense? If I can place each column of data into certain variable, pertained to each column, then I believe it would be easier to run the named variable through the function, and that value stored in another variable, and inserted into the temp file in a tab delimited text file. ? Not sure, but I think the logic would work. I am having problems creating it as I need it. Does this make sense?


Okay, then... Where I have "item to insert" is where you would put your function that returns a string and I think you said it does its thing from the 2nd colume so it would be...

Expand|Select|Wrap|Line Numbers


这篇关于帮助使用制表符分隔文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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