{"id":1313,"date":"2014-08-23T21:57:59","date_gmt":"2014-08-23T13:57:59","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=1313"},"modified":"2014-08-23T21:57:59","modified_gmt":"2014-08-23T13:57:59","slug":"mfc-cstring%e7%b1%bb%e4%b8%80%e4%b8%aa%e5%8f%af%e4%bb%a5%e6%9b%bf%e6%8d%a2%e6%8c%87%e5%ae%9a%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%ac%a1%e6%95%b0%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/1313","title":{"rendered":"mfc-cstring\u7c7b\u4e00\u4e2a\u53ef\u4ee5\u66ff\u6362\u6307\u5b9a\u5b57\u7b26\u4e32\u6b21\u6570\u7684\u51fd\u6570"},"content":{"rendered":"
mfc-cstring\u7c7b\u4e00\u4e2a\u53ef\u4ee5\u66ff\u6362\u6307\u5b9a\u5b57\u7b26\u4e32\u6b21\u6570\u7684\u51fd\u6570<\/strong><\/p>\n cstring\u8fd9\u4e2a\u7c7b\u6709\u4e00\u4e2areplace\u66ff\u6362\u51fd\u6570\uff0c\u53ef\u662f\u4e0d\u80fd\u6307\u5b9a\u66ff\u6362\u6b21\u6570\uff0c\u4e8e\u662f\u6211\u5c31\u5728cstring\u7c7b\u7684\u57fa\u7840\u4e0a\uff0c\u5199\u4e86\u4e00\u4e2a\u51fd\u6570\u3002\u51fd\u6570\u662f\u9ed8\u8ba4\u53ea\u66ff\u6362\u4e00\u6b21\u7684\uff0c\u4e0d\u8fc7\u53ea\u8981\u60a8\u81ea\u5df1\u7a0d\u52a0\u6539\u5199\u5c31\u53ef\u4ee5\u5f04\u6210\u66ff\u6362\u6307\u5b9a\u6b21\u6570\u7684\u51fd\u6570\u3002<\/p>\n \u5982\u679c\u5728\u5b57\u7b26\u4e32\u4e2d\u80fd\u627e\u5230\u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\uff0c\u5c31\u8fdb\u884c\u66ff\u6362\uff0c\u5e76\u8fd4\u56detrue,\u5982\u679c\u6ca1\u6709\u627e\u5230\uff0c\u90a3\u5c31\u8fd4\u56defalse!<\/p>\n \u6709\u95ee\u9898\u7ed9\u6211\u7559\u8a00\u5427\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" mfc-cstring\u7c7b\u4e00\u4e2a\u53ef\u4ee5\u66ff\u6362\u6307\u5b9a\u5b57\u7b26\u4e32\u6b21\u6570\u7684\u51fd\u6570 cstring\u8fd9\u4e2a\u7c7b\u6709\u4e00\u4e2areplace\u66ff\u6362\u51fd\u6570\uff0c\u53ef\u662f\u4e0d\u80fd\u6307\u5b9a\u66ff\u6362\u6b21\u6570\uff0c\u4e8e\u662f\u6211\u5c31\u5728cstring\u7c7b\u7684\u57fa\u7840\u4e0a\uff0c\u5199\u4e86\u4e00\u4e2a\u51fd\u6570\u3002\u51fd\u6570\u662f\u9ed8\u8ba4\u53ea\u66ff\u6362\u4e00\u6b21\u7684\uff0c\u4e0d\u8fc7\u53ea\u8981\u60a8\u81ea\u5df1\u7a0d\u52a0\u6539\u5199\u5c31\u53ef\u4ee5\u5f04\u6210\u66ff\u6362\u6307\u5b9a\u6b21\u6570\u7684\u51fd\u6570\u3002 \u5982\u679c\u5728\u5b57\u7b26\u4e32\u4e2d\u80fd\u627e\u5230\u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\uff0c\u5c31\u8fdb\u884c\u66ff\u6362\uff0c\u5e76\u8fd4\u56detrue,\u5982\u679c\u6ca1\u6709\u627e\u5230\uff0c\u90a3\u5c31\u8fd4\u56defalse! bool CStringReplaceOnce(CString * strSource, CString strMatch, CString strReplace) { \/\/\u5f97\u5230\u8d77\u59cb\u4f4d\u7f6e int nOrder = strSource-><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,219,9],"tags":[],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1313"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":1,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1314,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1313\/revisions\/1314"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}bool CStringReplaceOnce(CString * strSource, CString strMatch, CString strReplace)\r\n{\r\n\t\/\/\u5f97\u5230\u8d77\u59cb\u4f4d\u7f6e\r\n\tint nOrder = strSource->Find(strMatch);\r\n\tif (nOrder == -1)\r\n\t{\r\n\t\t\/\/\u8bf4\u660e\u6ca1\u6709\u627e\u5230,\u76f4\u63a5\u8fd4\u56de\u539f\u51fd\u6570\r\n\t\treturn false;\r\n\t\t\/\/return strSource;\r\n\t}\r\n\t\/\/\u5f97\u5230\u88ab\u66ff\u6362\u7684\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\r\n \tint nstrMatchLength = strMatch.GetLength();\r\n\t\/\/\u5220\u9664\u6307\u5b9a\u4f4d\u7f6e\u7684\u5b57\u7b26\u4e32\r\n\tstrSource->Delete(nOrder,nstrMatchLength);\r\n\t\/\/\u5728\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165\u65b0\u7684\u5b57\u7b26\u4e32\r\n\tstrSource->Insert(nOrder,strReplace);\r\n\treturn true;\r\n\t\/\/return strSource;\r\n\t\/\/return CString();\r\n}<\/pre>\n