npsc2012

2014年9月27日 星期六

csv to token "1,2,3" => [1,2,3]

std::string input = "abc,def,ghi";
std::istringstream ss(input);
std::string token;

while(std::getline(ss, token, ',')) {
    std::cout << token << '\n';
}
source:
http://stackoverflow.com/questions/11719538/how-to-use-stringstream-to-separate-comma-separated-strings

std::strtok

http://en.cppreference.com/w/cpp/string/byte/strtokk
張貼者: Unknown 於 下午6:32
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest

沒有留言:

張貼留言

較新的文章 較舊的文章 首頁
訂閱: 張貼留言 (Atom)

網頁

  • 首頁
  • NPSC
  • 台中女中解題系統
  • 網路資源
  • Books

著作人

  • Unknown
  • jedi qwerty
  • joy00526

網誌存檔

  • ►  2016 (1)
    • ►  1月 (1)
  • ▼  2014 (56)
    • ▼  9月 (2)
      • csv to token "1,2,3" => [1,2,3]
      • 跑者的修練
    • ►  8月 (7)
    • ►  7月 (8)
    • ►  6月 (3)
    • ►  5月 (17)
    • ►  4月 (4)
    • ►  3月 (4)
    • ►  2月 (8)
    • ►  1月 (3)
  • ►  2013 (20)
    • ►  12月 (5)
    • ►  11月 (8)
    • ►  8月 (3)
    • ►  7月 (1)
    • ►  6月 (3)
簡單主題. 技術提供:Blogger.