如何在文本文件中搜索 [英] How can I search in text file

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

问题描述

我想搜索特定的从到cout所有到它



这里是文件





Trip_ID:9

来自:开罗

到:Alex



Trip_ID:10

来自:开罗

到:abc



我想要输出为:

Alex

abc



我尝试过:



我试图分裂得到这个词但显然我做错了什么

I want to search for a specific "from" to cout all the "to" of it

here's the file


Trip_ID:9
From:Cairo
To:Alex

Trip_ID:10
From:Cairo
To:abc

I want the output to be:
Alex
abc

What I have tried:

I tried splitting to get the word but apparently I'm doing something wrong

推荐答案

真的很容易使用 std :: find 功能。


这篇关于如何在文本文件中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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