拆分字符串 [英] split string
本文介绍了拆分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好! :-D
好的,我已经遇到过很多这方面的功能,但都没有用!我需要一个
,其工作方式如下:
StringSplit(string str,string delim,vector< string> results)
无论是字符串还是字符数组,都没关系......有谁知道?谢谢
提前!
Hello everyone! :-D
OK, I''ve came across many functions for this, but none works! I need one
that works like this:
StringSplit(string str, string delim, vector<string> results)
Either with strings or char arrays, doesn''t matter... anyone know? Thanks in
advance!
推荐答案
2005年10月15日星期六03:40 :11 + 0300,< ch *** @ email.ua>写道:
On Sat, 15 Oct 2005 03:40:11 +0300, <ch***@email.ua> wrote:
大家好! :-
好的,我已经遇到过很多功能,但都没有用!
嗯...一定是相当常见的东西......想知道为什么它们都不起作用?
我需要一个这样的工作:
StringSplit(string str,string delim,vector< string> results)
使用字符串或char数组,没关系......有谁知道?谢谢
提前!
Hello everyone! :-D
OK, I''ve came across many functions for this, but none works!
Hmmm...must be fairly common stuff...wonder why none of them worked?
I need one that works like this:
StringSplit(string str, string delim, vector<string> results)
Either with strings or char arrays, doesn''t matter... anyone know? Thanks in
advance!
查看Boost tokenizer库:
http://www.boost.org
-
Bob Hairgrove
No**********@Home.com
这看起来非常简单。对于std :: string,有一个查找方法
。把它放在一个循环中,并将相应的
子串复制到向量。
This seems pretty straightforward. There''s a find method
for std::string. Put that in a loop, and copy the appropriate
substring(s) to the vector.
< ch *** @ email.ua>在留言新闻中写道:di ********** @ news.lucky.net ...
|大家好! :-D
|好的,我已经遇到过很多这方面的功能,但都没有用!我需要
一个
|这样工作:
| StringSplit(字符串str,字符串delim,vector< string>结果)
|
此新闻消息中的空间太小,无法显示
成员函数std :: string可以满足你的要求。
咨询......
http://www.sgi.com/tech/stl/basic_string.html
一旦你选择了一个策略,就发布你的尝试代码。
<ch***@email.ua> wrote in message news:di**********@news.lucky.net...
| Hello everyone! :-D
| OK, I''ve came across many functions for this, but none works! I need
one
| that works like this:
| StringSplit(string str, string delim, vector<string> results)
|
There is too little space in this news message to show you the myriad of
member functions a std::string has available to satisfy your request.
consult...
http://www.sgi.com/tech/stl/basic_string.html
Once you''ve chosen a strategy, post the code of your attempt.
这篇关于拆分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文