¤È¤¢¤ë½¸ÃÄ¤Î¥×¥í¥°¥é¥à¥á¥â


boost/algorithm

»ÈÍѤ·¤¿¥Ð¡¼¥¸¥ç¥ó¤Ïboost_1.42


split

include <boost/algorithm/string.hpp>

µ¡Ç½

ʸ»úʬ³ä´Ø¿ô¡¥Ç¤°Õ¤Î»ØÄꤷ¤¿Ê¸»ú¤Çʸ»úÎó¤òʬ³ä¤¹¤ë¡¥
// boost::algorithm::split(result, str, pred, token_compress)
 
 std::vector<std::string> result;
 std::string input;
 boost::algorithm::split( reult,
                          input,
                          boost::algorithm::is_any_of("./"),//'.'¡¤'/'¤Çʬ³ä¤¹¤ë¡¥
                          boost::algorithm::token_compress_on);
¤³¤ì¤Ç[/]¤Ç[input]¤òʬ³ä¤·¤¿·ë²Ì¤¬[result]¤Ë³ÊǼ¤µ¤ì¤ë¡¥
boost::algorithm::is_any_of("/")¤ÎÉôʬ¤Ïʬ³ä¤¹¤ëʸ»ú¤Î»ØÄê¡Ê¾¤Ë¤â´Ø¿ô¤¬¤¢¤ë¡Ë¡¥
boost::algorithm::token_compress_on ¤Ïʬ³ä·ë²Ì¤Î³ÊǼÊýË¡(token_compress_off¤â¤¢¤ë)¡¥

°ú¿ô

result
¼Â¹Ô·ë²Ì(std::vector<std::string>)
str
ÆþÎÏʸ»úÎó(std::string)
pred
[»²¾È] http://d.hatena.ne.jp/scior/20100811/1281537296
½ÒÉôȽÊ̤¹¤ëʸ»ú
is_any_ofǤ°Õ¤Îʸ»ú
is_digit¿ô»ú(0-9)
is_alpha񥯣(a-z,A-Z)
is_lower¾®Ê¸»ú(a-z)
is_upperÂçʸ»ú(A-Z)
is_alnum±Ñ¿ô»ú(0-9,a-z,A-Z)
is_graphµ­¹æʸ»ú(0x21-0x7e)
is_cntrlÀ©¸æʸ»ú(0x00-0x1f,0x7f)
is_space¶õÇò(0x20,\t,\n,\f,\r,\v)
is_punct¶çÆÉÅÀÅù(µ­¹æʸ»ú¢Á±Ñ¿ô»ú°Ê³°)
is_xdigit16¿Êɽµ­¤Ë»È¤¨¤ëʸ»ú(0-9,a-f,A-F)
is_from_rangeÈÏ°Ï»ØÄê
token_compress
°Ê²¼¤ÎÆþÎÏʸ»ú¤ËÂФ¹¤ë½èÍý·ë²Ì¤ò¼¨¤¹¡¥
    • ÆþÎÏʸ»ú:"hoge./hoge/hoge"
mode¶èÀÚ¤êʸ»ú·ë²Ì
token_compress_on./"hoge"¡¤"hoge"¡¤"hoge"Ϣ³¤·¤¿¶èÀÚ¤ê¤ò¤Þ¤È¤á¤ë
token_compress_off./"hoge"¡¤""¡¤"hoge"¡¤"hoge"Ϣ³¤·¤¿¶èÀÚ¤ê¤ò¤Þ¤È¤á¤Ê¤¤
¥¿¥°

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

¥á¥ó¥Ð¡¼¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹