• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿
            本文主要涉及boost中algorithm之string問題
            基本的字符串函數類型有
            替換
            裁剪
            大小寫替換
            正則表達式
            切割
            判斷
            和擦除操作等等
            //! boost之2:字符串算法類 
            #include <string>
            #include 
            <vector>
            #include 
            <iostream>
            #include 
            <iterator>
            #include 
            <functional>
            #include 
            <boost/algorithm/string.hpp>

            using namespace std;
            using namespace boost;

            int main()
            {  
                
            //! 字符串 
                string str(" abc-*-ABC-*-aBc ");
                
                
            //! 以-或者*切割字符串 
                vector<std::string> ret;
                split(ret,str,is_any_of(
            "-*"),token_compress_on);

                
            for(unsigned int index=0;index<ret.size();index++)
                {
                    cout
            <<index<<":"<<ret[index]<<endl;
                };
                
                
            //! 切換為小寫
                to_lower(str); 
                cout
            <<"*"<<str<<"*"<<endl;
                
            //! 去掉左邊的空格
                trim_left(str);
                cout
            <<"*"<<str<<"*"<<endl;
                
            //! 去掉右邊的空格
                trim_right(str);
                cout
            <<"*"<<str<<"*"<<endl;
                
                
            //! 替換
                replace_all(str,"a","A"); 
                cout
            <<str<<endl;
                
            //! 擦除 
                cout<<erase_all_copy(str,"A")<<endl;
                
                replace_nth(str,
            "c",2,"ccsdu2004"); 
                cout
            <<str<<endl;
                
                
            //! 擦除給定范圍
                cout<<erase_range_copy(str,make_iterator_range(str.begin()+2,str.begin()+5))<<endl; 
                
                cout
            <<"is start with:A:"<<starts_with(str,string("A"))<<endl;
                cout
            <<"is end with:C:"<<ends_with(str,string("C"))<<endl;
                cout
            <<"is contain with:ccs:"<<contains(str,string("ccs"))<<endl;
                
                cout
            <<endl;
                system(
            "PAUSE");
                
            return 0;
            }


            posted on 2010-08-10 10:11 ccsdu2009 閱讀(637) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            午夜精品久久久内射近拍高清 | 久久久久久精品免费免费自慰| 日本道色综合久久影院| 日本精品久久久久中文字幕8| 青青青青久久精品国产| 日韩欧美亚洲综合久久影院Ds| 久久国产精品一区| 亚洲AV乱码久久精品蜜桃| 久久精品国内一区二区三区| 久久本道久久综合伊人| 久久AV无码精品人妻糸列| 久久亚洲国产精品一区二区| 久久综合色区| 嫩草影院久久99| 一本一道久久综合狠狠老| 99久久国产综合精品网成人影院| 久久人妻无码中文字幕| 天天久久狠狠色综合| 麻豆av久久av盛宴av| 久久国产一区二区| 久久人人爽人人爽人人片AV高清| 色综合久久久久网| 国产亚洲精品美女久久久| 无码人妻久久一区二区三区蜜桃 | 999久久久免费精品国产| 一本一本久久a久久精品综合麻豆| 国内精品九九久久久精品| 少妇人妻综合久久中文字幕| 2021国产成人精品久久| 人妻无码αv中文字幕久久 | 久久影院综合精品| 婷婷久久五月天| 99久久婷婷免费国产综合精品| 久久久久亚洲AV成人网人人软件| 国产V亚洲V天堂无码久久久| 亚洲欧美国产精品专区久久| 伊人久久综合热线大杳蕉下载| 日产精品久久久久久久| 久久亚洲精品中文字幕| 久久青青草原亚洲av无码app| 国产成人久久精品一区二区三区|