进行搜索引擎的详细说明
我需要做一个适用于PowerPoint文件的搜索引擎.
I need to do a search engine that works on power point files.
在我的.vb(.net框架)代码文件中,我设计了一个按钮和一个文本框,当我在文本框中键入文件名时,文件名将显示在listview中. (很好)
in my .vb (.net framework) code file i have designed a button and a textbox and when i key in the filename in the textbox, the filename show up in the listview . (which is good)
但是我要输入一个关键字,搜索结果应该是包含该单词的文件名.
but what i want is to put a keyword and the search results should be filenames that contain that word.
基本上,搜索引擎应该像这样
basically the search engine should work like this
如果有人可以告诉我如何完成此任务,
if anyone can tell me how to get this done,
非常感谢(请)
但是我要输入一个关键字,搜索结果应该是包含该单词的文件名.
but what i want is to put a keyword and the search results should be filenames that contain that word.
您是指包含该单词的文件名,还是包含该单词的文件名?
Do you mean filenames that contain that word, or the names of files that contain that word?
要查找文件名中是否包含该单词,请使用String对象的.Contains方法和文件名列表:
https://msdn.microsoft.com/en-us/library/dy85x1sa (v = vs.110).aspx
To find if any of the filenames contains that word, use the .Contains method of the String object with the filename list:
https://msdn.microsoft.com/en-us/library/dy85x1sa(v=vs.110).aspx
读取文件的说明如下:
https://msdn.microsoft.com/en-us/library/wz100x8w.aspx
Reading a file is described here:
https://msdn.microsoft.com/en-us/library/wz100x8w.aspx
如果您以文本形式读取文件,则可以对文件内容使用.contains方法.您可能需要将其读取为字节数组并将该数组转换为字符串,以避免出现错误的结尾文件条件.即使应该也可以 该文件不是文本文件,但值得测试.
If you read a file as text then you can use the .contains method with the file contents. You may need to read it as a byte array and convert the array to string, in order to avoid a false end-of-file condition. That should work even though the file is not a text file, but is worth testing.