• <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 閱讀(643) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            无码国内精品久久综合88| 精品久久久久久国产| 精品免费久久久久国产一区| 久久无码人妻一区二区三区午夜| 久久久久亚洲av成人网人人软件 | 国产午夜精品理论片久久影视| 精品一区二区久久久久久久网站| 国产精品热久久毛片| 久久人人爽人人爽人人爽| 色综合久久中文色婷婷| 久久久久久国产a免费观看不卡| 亚洲国产精品无码久久98| 国产一久久香蕉国产线看观看| 久久久精品国产亚洲成人满18免费网站| 久久99精品久久久久久齐齐| 777米奇久久最新地址| 久久精品综合网| 香蕉久久久久久狠狠色| 99久久精品免费看国产| 日韩亚洲欧美久久久www综合网| 亚洲伊人久久精品影院| 久久人人爽人人爽人人片AV东京热 | 国产国产成人久久精品| 久久97久久97精品免视看| 国产99久久久国产精品~~牛| 2020久久精品国产免费| 99久久精品国产免看国产一区| 久久久久久夜精品精品免费啦| 久久久亚洲裙底偷窥综合| 国产成人精品久久| 久久99精品久久久久久hb无码| 婷婷综合久久中文字幕蜜桃三电影| 久久久无码精品亚洲日韩按摩| 国产精品美女久久久久| 精品水蜜桃久久久久久久| 国色天香久久久久久久小说| 亚洲中文字幕无码久久2020| 精品久久777| 97精品伊人久久大香线蕉app| 久久婷婷色综合一区二区| 久久久久久久亚洲Av无码|