帮助阅读文本文件中的字段 [英] help with reading fields in a text file

查看:88
本文介绍了帮助阅读文本文件中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助阅读文本文件中的字段。

我需要获取索引名称,(文本文件中的自动收录器字段),

请参阅一个文件一个例子(实际上有1000个文件)


如果我们打开文件,文本包括标题和数据

TICKER>,< PER>,< ; DTYYYYMMDD>,< TIME>,< OPEN>,< HIGH>,< L OW>,< CLOSE>,< VOL>,< OPENINT>

..A1DOW ,M,19980630,000000,264.2900,264.9700,250.80 00,264.2900,0,0

..A1DOW,M,19980731,000000,260.3700,276.5900,260.37 00,260.3700,0,0


我需要首先阅读自动收录机A1DOW和M来控制,(稍后我将

将自动收报机与现有数据库进行比较,并加载数据。


感谢您提供任何信息,我应该研究哪种方法?

我非常感谢。


Vicky


-

通过 http://发布消息万维网。 dotnetmonster.com

Please help with reading fields in a text file.
I need to get the index name, (ticker field in text file),
Please see one file as an example (There are actually 1000 files)

If we open the file, the text includes Header and data
TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<L OW>,<CLOSE>,<VOL>,<OPENINT>
..A1DOW,M,19980630,000000,264.2900,264.9700,250.80 00,264.2900,0,0
..A1DOW,M,19980731,000000,260.3700,276.5900,260.37 00,260.3700,0,0

I need to read the ticker A1DOW and M to console first, (later I will
compare the ticker with existing DB, and load the data.

Thank you for any info, which method I should look into it?
I really appreciated.

Vicky

--
Message posted via http://www.dotnetmonster.com

推荐答案

您好,


查看CSV数据提供商来自opennetcf.org


欢呼,

-

Ignacio Machin,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局


" Vicky via DotNetMonster.com" < FO *** @ nospam.DotNetMonster.com>写在

消息新闻:9a ****************************** @ DotNetMonste r.com。 ..
Hi,

Take a look at the CSV data provider from opennetcf.org

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Vicky via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:9a******************************@DotNetMonste r.com...
请帮助阅读文本文件中的字段。
我需要获取索引名称,(文本文件中的自动收录器字段),
请参阅一个文件作为示例(实际上有1000个文件)

如果我们打开文件,文本包括标题和数据
TICKER>,< PER>,< DTYYYYMMDD>,< TIME>, < OPEN>,< HIGH>,< L OW>,< CLOSE>,< VOL>,< OPENINT>
.A1DOW,M,19980630,000000,264.2900,264.9700,250.800 0,264.2900, 0,0
.A1DOW,M,19980731,000000,260.3700,276.5900,260.370 0,260.3700,0,0
我需要先阅读自动收录机A1DOW和M来控制,(后来我将
将自动收报机与现有数据库进行比较,并加载数据。

感谢您提供任何信息,我应该研究哪种方法?
我真的很感激。
Vicky

- 通过 http://www.dotnetmonster.com
Please help with reading fields in a text file.
I need to get the index name, (ticker field in text file),
Please see one file as an example (There are actually 1000 files)

If we open the file, the text includes Header and data
TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<L OW>,<CLOSE>,<VOL>,<OPENINT>
.A1DOW,M,19980630,000000,264.2900,264.9700,250.800 0,264.2900,0,0
.A1DOW,M,19980731,000000,260.3700,276.5900,260.370 0,260.3700,0,0

I need to read the ticker A1DOW and M to console first, (later I will
compare the ticker with existing DB, and load the data.

Thank you for any info, which method I should look into it?
I really appreciated.

Vicky

--
Message posted via http://www.dotnetmonster.com



我还出售一个可能的csv解析器让这个文件更容易阅读。

网站上有可用的演示版本。

http://www.geocities.com/shriop/index.html

I also sell a csv parser that might make reading this file easier.
There''s demo version available on the site.

http://www.geocities.com/shriop/index.html


从文件中读取这些值的一种非常简单的方法是使用

String.Split方法,如下所示:

StreamReader sr = new StreamReader(filePath);


string currentLine = null;


do

{

currentLine = sr.ReadLine();

string [] data = currentLine.Split('','');


string val1 = data [0];

string val2 = data [1];

//等等


} while(currentLine!= null);


希望这会有所帮助。

Cordell Lawrence

Te leios Systems Ltd.

" Vicky via DotNetMonster.com" < FO *** @ nospam.DotNetMonster.com>写在

消息新闻:9a ****************************** @ DotNetMonste r.com。 ..
A very easy way to read these values from the file will be to use the
String.Split method like so:

StreamReader sr = new StreamReader(filePath);

string currentLine = null;

do
{
currentLine = sr.ReadLine();
string[] data = currentLine.Split('','');

string val1 = data[0];
string val2 = data[1];
// etc.

}while(currentLine != null);

Hope this helps.
Cordell Lawrence
Teleios Systems Ltd.
"Vicky via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:9a******************************@DotNetMonste r.com...
请帮助阅读文本文件中的字段。
我需要获取索引名称,(文本文件中的自动收录器字段),
请参阅一个文件作为示例(实际上有1000个文件)

如果我们打开文件,文本包括标题和数据

TICKER>,< PER>,< DTYYYYMMDD>,< ; TIME>,< OPEN>,< HIGH>,< L OW>,< CLOSE>,< VOL>,< OPENINT
.A1DOW,M,19980630,000000,264.2900,264.9700, 250.800 0,264.2900,0,0
.A1DOW,M,19980731,000000,260.3700,276.5900,260.370 0,260.3700,0,0
我需要先读取自动收录机A1DOW和M来控制, (稍后我会将自动收报机与现有数据库进行比较,并加载数据。

感谢您提供任何信息,我应该研究哪种方法?
我真的很感激。

Vicky

-
通过 http://www.dotnetmonster.com
Please help with reading fields in a text file.
I need to get the index name, (ticker field in text file),
Please see one file as an example (There are actually 1000 files)

If we open the file, the text includes Header and data
TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<L OW>,<CLOSE>,<VOL>,<OPENINT
.A1DOW,M,19980630,000000,264.2900,264.9700,250.800 0,264.2900,0,0
.A1DOW,M,19980731,000000,260.3700,276.5900,260.370 0,260.3700,0,0

I need to read the ticker A1DOW and M to console first, (later I will
compare the ticker with existing DB, and load the data.

Thank you for any info, which method I should look into it?
I really appreciated.

Vicky

--
Message posted via http://www.dotnetmonster.com



这篇关于帮助阅读文本文件中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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