[html] view plaincopy
<span style="font-weight: normal;"><span style="font-size:14px;"> std::string name = "tony";
std::string name = std::string("tony");</span></span>
[html] view plaincopy
<span style="font-weight: normal;"><span style="font-size:14px;">const char* cstring = name.c_str();</span></span>
[html] view plaincopy
<span style="font-weight: normal;"><span style="font-size:14px;"> std::string* name =newstd::string("tony");
… …
delete name;</span></span>
[html] view plaincopy
<span style="font-weight: normal;"><span style="font-size:14px;"> const char* cstring = name->c_str();</span></span>
<span ><span >static__String * create (const std::string &str) static__String * createWithFormat (const char *format,...)</span></span>
<span ><span >__String* name= __String::create("Hi,Tony"); int num=123; __String* ns = __String::createWithFormat("%d",num); </span></span>
<span ><span >__String* name= __String::create("Hi,Tony"); const char *cstring=name->getCString();</span></span>
<span ><span >const char* cstring = "Hi,Tony"; __String*ns=__String::createWithFormat("%s",cstring);</span></span>
<span ><span >std::string string = "Hi,Tony"; __String*ns=__String::createWithFormat("%s",string.c_str());</span></span>
<span ><span >int num = 123; __String* ns =__String::createWithFormat("%d",num); int num2 = ns->intValue();</span></span>
更多內(nèi)容請關(guān)注Cocos2d-x系列圖書《Cocos2d-x實戰(zhàn)(卷Ⅰ):C++開發(fā)》
本書交流討論網(wǎng)站:http://www.cocoagame.net
歡迎加入cocos2d-x技術(shù)討論群:257760386、327403678
更多精彩內(nèi)容請關(guān)注史上最牛的cocos2d-x課程
《cocos2d-x手機游戲開發(fā)實戰(zhàn)》直播課程第一期
報名Cocos2d-x直播課程還送關(guān)東升老師iOS終身會員。
課程鏈接:http://edu.51cto.com/pack/view/id-13.html
會員鏈接:http://edu.51cto.com/member/id-3.html
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
新聞名稱:Cocos2d-x中的字符串-創(chuàng)新互聯(lián)
URL鏈接:http://jinyejixie.com/article42/dhophc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務器、網(wǎng)站導航、營銷型網(wǎng)站建設(shè)、全網(wǎng)營銷推廣、網(wǎng)站設(shè)計、虛擬主機
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)