[英]How to skip to next line after the last number found in each line when reading a text file?
My text file look something like this: 我的文本文件如下所示:
1 2 3 test//test
4 5 6 dummy//dummy
How can I read this file and only process the numbers present in each line? 如何读取此文件,仅处理每一行中存在的数字?
Two ways: 两种方式:
By ignoring the rest of the line . 通过忽略其余部分 。
By reading the complete line into a string , put the string in an output string stream , and read only the leading three numbers from the output string stream. 通过将整行读入字符串 ,将字符串放入输出字符串流 ,并仅读取输出字符串流中的前三个数字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.