在文件解析中,读取readfile或streamreader文件后读取文本文件的前几个字符... [英] In file parsing, taking the first few characters of a text file after a readfile or streamreader file read...

查看:64
本文介绍了在文件解析中,读取readfile或streamreader文件后读取文本文件的前几个字符...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VB.net中,我试图在几个不同的b $ b b代码块中做一些事情。我需要取一个文本文件的前25个字符,

然后在末尾添加一些省略号和一个更多链接到一个网页,其中

观众可以阅读其余的文章:

这是我文件中文字的前几个字符.......< a

href =" article-to-read。 ASPX">更多< / a>

...我还需要在文件解析中做一些工作,我从一个已知的

关键字开始(例如START),抓住所有文本直到,让我们说

下一个< / td>,将它全部放入变量中,然后能够使用

该变量来显示从START到

< / td>的所有文本的结果。 IndexOf看起来像我可能需要使用的内置函数,但是

很难找到文件搜索中的方法和参数



谢谢

netsports

In VB.net, I''m trying to do a couple of things in a couple of different
blocks of code. I need to take the first 25 characters of a text file,
then append at the end some ellipses and a MORE link to a webpage where
viewers can read the rest of the article:
This is the first few characters of text from my file.......<a
href="article-to-read.aspx"> MORE </a>
...I also need to do some in file parsing where I start at one known
keyword (START for an example) , grab all the text until , let''s say
the next </td>, put it all into a variable, and then be able to use
that variable to display the results of all the text from START to
</td> . IndexOf seems like the builtin function I may need to use, but
having difficulty finding methods and arguments to do in file searching
for this.

thanks
netsports

推荐答案

对不起,

这是C#(我是VB.NET - 挑战),但你明白了。

彼得


-

联合创始人,Eggheadcafe.com开发人员门户网站:
http://www.eggheadcafe.com

UnBlog:
http:// petesbloggerama。 blogspot.com


" .Net Sports"写道:
Sorry,
that was C# (I''m VB.NET - challenged) but you get the idea.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


".Net Sports" wrote:
在VB.net中,我试图在几个不同的代码块中做几件事。我需要取一个文本文件的前25个字符,
然后在末尾添加一些省略号和一个更多链接到一个网页,其中
观众可以阅读文章的其余部分:
这是我文件中文字的前几个字符.......< a
href =" article-to-read.aspx">更多< / a>
...我还需要在文件解析中做一些工作,我从一个已知的
关键字开始(例如START),抓住所有文本直到,让's'说下一个< / td>,将它全部放入变量中,然后能够使用该变量来显示从START到
< /的所有文本的结果TD> 。 IndexOf看起来像我可能需要使用的内置函数,但是很难找到文件搜索中的方法和参数。

感谢
netsports
In VB.net, I''m trying to do a couple of things in a couple of different
blocks of code. I need to take the first 25 characters of a text file,
then append at the end some ellipses and a MORE link to a webpage where
viewers can read the rest of the article:
This is the first few characters of text from my file.......<a
href="article-to-read.aspx"> MORE </a>
...I also need to do some in file parsing where I start at one known
keyword (START for an example) , grab all the text until , let''s say
the next </td>, put it all into a variable, and then be able to use
that variable to display the results of all the text from START to
</td> . IndexOf seems like the builtin function I may need to use, but
having difficulty finding methods and arguments to do in file searching
for this.

thanks
netsports



你想使用Substring方法,结合IndexOf和相关的

之类的东西。


string newStr = MyText.Substring(0,25)



string newStr = MyText.Substring(0,MyText.LastIndexOf (< BR>");

Peter

-

联合创始人,Eggheadcafe.com开发者门户网站:
http://www.eggheadcafe.com

UnBlog :
http://petesbloggerama.blogspot.com



" .Net Sports"写道:
You want to use the Substring method, combined with IndexOf and related for
stuff like this.

string newStr =MyText.Substring(0, 25)
or
string newStr=MyText.Substring(0, MyText.LastIndexOf("<BR>");
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


".Net Sports" wrote:
在VB.net中,我正在努力做一些事情。许多不同的代码块。我需要取一个文本文件的前25个字符,
然后在末尾添加一些省略号和一个更多链接到一个网页,其中
观众可以阅读文章的其余部分:
这是我文件中文字的前几个字符.......< a
href =" article-to-read.aspx">更多< / a>
...我还需要在文件解析中做一些工作,我从一个已知的
关键字开始(例如START),抓住所有文本直到,让's'说下一个< / td>,将它全部放入变量中,然后能够使用该变量来显示从START到
< /的所有文本的结果TD> 。 IndexOf看起来像我可能需要使用的内置函数,但是很难找到文件搜索中的方法和参数。

感谢
netsports
In VB.net, I''m trying to do a couple of things in a couple of different
blocks of code. I need to take the first 25 characters of a text file,
then append at the end some ellipses and a MORE link to a webpage where
viewers can read the rest of the article:
This is the first few characters of text from my file.......<a
href="article-to-read.aspx"> MORE </a>
...I also need to do some in file parsing where I start at one known
keyword (START for an example) , grab all the text until , let''s say
the next </td>, put it all into a variable, and then be able to use
that variable to display the results of all the text from START to
</td> . IndexOf seems like the builtin function I may need to use, but
having difficulty finding methods and arguments to do in file searching
for this.

thanks
netsports



谢谢....


.....任何人都可以提供vb。净当量?

Thanks....

.....can anyone provide a vb.net equivalent?


这篇关于在文件解析中,读取readfile或streamreader文件后读取文本文件的前几个字符...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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