C++11 字符串分割

Using explode function as it used in PHP programming.
The code above just a simple function, yet well-tested with various case. Following is the example in main function:
 

 
int main()
{
	
  string str{"the quick brown fox jumps over the lazy dog"};
	
  vector<string> v{explode(str, ' ')};
	
  for(auto n:v) 
    cout << n << endl;
	
	
  return 0;

}

Edit & Run



will produces output:
 

the
quick
brown
fox
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章