从文本文件中拆分句子 [英] split sentence from text file

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

问题描述

大家好,
请问有人知道如何从文本文件中拆分一个句子吗?尽管我知道它的开头和结尾,但我只是从头开始进行了拆分,但其余文本仍然存在.
有人知道吗?

解决方案

如果您知道句子的开头和结尾,请使用string.Substring将其提取到其自己的变量中,然后使用string.Split是的,我知道但是子字符串需要int的问题,而我想分割一个字符串并且它在我的文本文件中具有不同的位置..

=============

来自JSOP:我没有精力去弄清楚你想说什么.简短版本-您必须从文本文件中提取句子.我不知道如何告诉您执行此操作的最佳方法,因为我对您希望文件包含的内容一无所知.在某个时候,您将不得不坐下来仔细考虑一下,然后编写执行指定任务所需的代码.


Hi all,
please does anyone know how can I split just one sentence from text file? Though I know the start and the end of it, I just split it from the start but the rest of the text is still there.
Does anyone know how?

解决方案

If you know the start and end of the sentence, extract it into its own variable with string.Substring, and then use string.Split on the extracted sentence.


yes i know but the problem that substring takes int ,, while i want to split a string and it has different locations in my text files ..

==============

From JSOP: I don''t have the energy to try to figure out qwhat you''re trying to say. The short version - you have to extract your sentence from the text file. I don''t know how to tell you the best way to do that because I don''t have any clue as to what you expect the file to contain. At some point, you''re gonna have to just sit down and think it through, and then write the code you need to perform the specified task.


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

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