由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - help on string parse
相关主题
请教一个C++关于输入输出的问题C++ string类输入数据的问题
how to read a sentence into a vector of string?问个C/C++题目
C++中parse string的问题New C++ programmer, need to ask a I/O file read question
怎样才能用perl等东西知道c macro中的数值C++ string to int Problem
关于scala的levelQuestion: automatically download website data
parsing file in node: js or python ?C++读文本文件怎么判断换行?
关于文件读取的C++ 问题?C++如何输入的一个小问题
C++ read matrix from txt fileC++ Q13: Input
相关话题的讨论汇总
话题: delimiter话题: parse话题: name话题: seperate话题: each
进入Programming版参与讨论
1 (共1页)
t*********n
发帖数: 278
1
I need to read a address book file. Each line is composed of street name,
city name, and extra. The problem is that the words in city name and street
name are seperated by space. I can not parse the line just by space
delimiter. I am thinking to use some special delimiter, like "|', to
seperate each field. Did C++ have some kind of building function to
automatically seperate the fields, which are broken by the delimiter.
O*******d
发帖数: 20343
2
The answer is no. Java has StringTokenizer. C++ has no such a thing. You
have to build it yourself. Or you may get it somewhere on the internet.
P********e
发帖数: 2610
3
sscan可以

I need to read a address book file. Each line is composed of street name,
city name, and extra. The problem is that the words in city name and street
name are seperated by space. I can not parse the line just by space
delimiter. I am thinking to use some special delimiter, like "|', to
seperate each field. Did C++ have some kind of building function to
automatically seperate the fields, which are broken by the delimiter.

【在 t*********n 的大作中提到】
: I need to read a address book file. Each line is composed of street name,
: city name, and extra. The problem is that the words in city name and street
: name are seperated by space. I can not parse the line just by space
: delimiter. I am thinking to use some special delimiter, like "|', to
: seperate each field. Did C++ have some kind of building function to
: automatically seperate the fields, which are broken by the delimiter.

k****f
发帖数: 3794
4
试试strtok

street

【在 t*********n 的大作中提到】
: I need to read a address book file. Each line is composed of street name,
: city name, and extra. The problem is that the words in city name and street
: name are seperated by space. I can not parse the line just by space
: delimiter. I am thinking to use some special delimiter, like "|', to
: seperate each field. Did C++ have some kind of building function to
: automatically seperate the fields, which are broken by the delimiter.

c*********h
发帖数: 125
5
try getline, its last parameter is delimiting character.
z********0
发帖数: 9013
6
boost
1 (共1页)
进入Programming版参与讨论
相关主题
C++ Q13: Input关于scala的level
C++ 屏幕输入问题parsing file in node: js or python ?
Linux下C++如何快速返回超大文件的某一行字符串?关于文件读取的C++ 问题?
输入输出流,stl,api精通各需要多长时间?C++ read matrix from txt file
请教一个C++关于输入输出的问题C++ string类输入数据的问题
how to read a sentence into a vector of string?问个C/C++题目
C++中parse string的问题New C++ programmer, need to ask a I/O file read question
怎样才能用perl等东西知道c macro中的数值C++ string to int Problem
相关话题的讨论汇总
话题: delimiter话题: parse话题: name话题: seperate话题: each