通过拆分读取文本文件? [英] read through a textfile with split?

查看:56
本文介绍了通过拆分读取文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个程序,用户在其中向文本框中输入单词,我希望vb检查该单词是否存在于用户计算机桌面上的文本文件中,如果显示,则显示一个消息框.

对于此示例,我使用以下内容:

ReaderTextFile.txt-文件名
txtFileStr-文本框

texfile可以包含单词列表,如下所示:



i have a programme where the user enters a word into a textbox and i want vb to check if that word exists in a textfile located on the desktop of the user''s computer and if it is then a messagebox is displayed.

for this example i am using the following:

ReaderTextFile.txt - File Name
txtFileStr - Textbox

texfile can contain a list of words like below:

this
is
a
textfile


抱歉,我没有提供任何代码,因为我是新手,也不知道如何执行此任务.

谢谢任何帮助者.


sorry i haven''t provided any code as i am a novice and have no idea of how to go about with this task.

thank you to any helpers.

推荐答案

String.IndexOf (如果您有空闲时间,请查看正则表达式)

另外,尝试练习谷歌搜索技能.根据您的技能水平,以下是Google可能需要的一些附加术语:
System.IO.File.ReadAllLines (there are more optimal ways than this, but this is a start at least)

String.IndexOf (when you have some free time, look into regular expressions as well)

Also, try practicing your Googling skills. Here are some additional terms you may need to Google, depending on your skill level:
VB.Net
MSDN
string operations
for loop


另外,在VB.Net上阅读一本书.大多数包含有关文件操作的部分.


Also, read a book on VB.Net. Most contain sections about file operations.


这篇关于通过拆分读取文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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