inline void string_split(const std::string& c_st_parent, const std::string& c_st_sep,
std::vector<std>* pvec_st_child)
{   
  string::size_type base = 0;
  string::size_type end = 0;
  string::size_type sep_len = c_st_sep.length();

  pvec_st_child->clear();
   /* pvec_st_child->reserve(16); 적당한 크기로 공간을 예약해 주면 좋겠죠 : ) */ 
  while ( (end = c_st_parent.find_first_of(c_st_sep, base)) >= 0)
  {
   pvec_st_child->push_back(c_st_parent.substr(base, end - base));
   base = end + sep_len;
  }
   pvec_st_child->push_back(c_st_parent.substr(base, end - base));
  }

Related Posts

답글 남기기

이메일 주소는 공개되지 않습니다.