如何从一条线上取出一个特定的句子 [英] How can I take a specific sentence out of a line

查看:79
本文介绍了如何从一条线上取出一个特定的句子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我有一个包含这样的行的文件...



 app_title_data =  这是应用程序的标题 
app_subtitle_data = 这是副标题
;评论在这里
app_content = 内容在这里





我可以使用文件阅读器检索整行...

我想在特定关键字的双引号内获取字符串, ,

但是我不想为每个字符循环,,,因为文件可能非常大...

现在我使用此代码来分割关键字和价值......



  string  [] str = line.Trim ()。Split( new   string  [] {  =},StringSplitOptions.None); 





Any建议??

解决方案

当使用阅读器读取文件时,做一件事就是在循环内的每一行字符串。从该结果中,您可以使用split函数

 result.Split( new   string  [] {  =},StringSplitOptions.None); 



希望这有帮助


我知道了...

谢谢亲爱的朋友们,,,,



http://stackoverflow.com/questions/378415/how-do-i-extract-a-string-of-text-that-lies-between-two-parenthesis-using-net

Hi friends,

I have a file that contains lines like this ...

app_title_data = "This is the title of the application"
app_subtitle_data = "This is the subtitle"
; Comment goes here
app_content ="Content goes here"



I could retrieve the entire line using file reader...
I want to get the string inside double quotes for the specific keyword,,,
But I dont want to loop for each character,,, since the file may be very large...
Now I am using this code to split the keyword and value...

string[] str = line.Trim().Split(new string[] { "=" }, StringSplitOptions.None);



Any suggestions ??

解决方案

Do one thing concantanate each line of a string inside the loop while when reading the file using reader. from that result you can use the split function

result.Split(new string[] { "=" }, StringSplitOptions.None);


Hope this helps


I got it...
Thanks dear friends,,,,

http://stackoverflow.com/questions/378415/how-do-i-extract-a-string-of-text-that-lies-between-two-parenthesis-using-net


这篇关于如何从一条线上取出一个特定的句子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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