C#从文本中获取特定数据
我仍然是C#及其格式的新手,因此我可能很难解释自己想要的东西。但是,是否有一种方法可以在文本文件(.txt)中读取,并且仅拉出某些数据行,特别是当行中线超过8英寸,(逗号)并忽略其余的数据时?
试图在控制框上捕获数据,并且它在调试中发送的数据具有从电动机位置,速度,轴等上的所有内容。但是它还包括不需要的数据即可将其绘制到Excel中,例如Motor停止,确认等额外评论等。这些线条往往只有1-3个逗号,而我想提取的数据进行分析的数据涵盖了8+逗号,以获取所有详细信息。
感谢您对此的任何提示/建议,或者能够将我指向我缺少的术语的正确方向,从而实现我想要的东西。到目前为止,我已经弄清楚了文件。阅读功能,我认为这是一个不错的开始。但是,不确定使用哪种术语或功能来尝试表达我需要的其余部分。
I am still new to C# and its formatting in general, so I may have a hard time explaining what I'm looking for. But is there a method to read in a text file (.txt) and only pull certain lines of data, specifically when the line has more than 8 "," (commas) in the line, and ignore the rest?
Trying to capture data on a control box, and the data it sends out in debug has everything from motor position, velocity, axis, and more. But it also includes data not needed to graph into excel such as extra comments like Motor has stopped, Acknowledge, and so on. Those lines tend to only have 1-3 commas, whereas the data I'd like to extract for analysis is covered in 8+ commas for all the details given.
Thanks for any tips/advice on this or being able to point me in the right directions with the terminology I'm lacking which does what I'm looking for. I've figured out the File.ReadAllText function so far, and I think that's a good start. But not really sure which terms or functions are used to try to express the rest of what I'm needing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论