はきだめC/C++下級者の質問箱 2
at TECH
11:デフォルトの名無しさん
06/08/25 23:22:57
>>6
/**
文字列を指定の文字で分割し、単語のリストを作ります
@param text 入力文字列(","や";"を含む文字列)
@param separators 分裂文字列(",.;:","\n")
@param words 出力文字列リスト
*/
bool split(const string& text,
const string& separators,
vector<string>& words)
{
int n = text.length();
int start = text.find_first_not_of(separators);
while ((start >= 0) && (start < n))
{
int stop = text.find_first_of(separators, start);
if ((stop < 0) || (stop > n)) stop = n;
words.push_back (text.substr(start, stop-start));
start = text.find_first_not_of(separators, stop+1);
}
return true;
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4865日前に更新/249 KB
担当:undef