{"id":198,"date":"2008-12-04T08:49:06","date_gmt":"2008-12-04T00:49:06","guid":{"rendered":""},"modified":"2014-02-27T22:59:40","modified_gmt":"2014-02-27T14:59:40","slug":"%e6%94%b9%e8%bf%9b-asp-%e7%9a%84%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%a4%84%e7%90%86%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2008\/12\/04\/198.htm","title":{"rendered":"\u6539\u8fdb ASP \u7684\u5b57\u7b26\u4e32\u5904\u7406\u6027\u80fd"},"content":{"rendered":"<p><b>\u6458\u8981\uff1a<\/b>\u5927\u591a\u6570 Active Server Pages (ASP) \u5e94\u7528\u7a0b\u5e8f\u90fd\u8981\u901a\u8fc7\u5b57\u7b26\u4e32\u8fde\u63a5\u6765\u521b\u5efa\u5448\u73b0\u7ed9\u7528\u6237\u7684 HTML \u683c\u5f0f\u7684\u6570\u636e\u3002\u672c\u6587\u5bf9\u51e0\u79cd\u521b\u5efa\u6b64 HTML \u6570\u636e\u6d41\u7684\u65b9\u6cd5\u8fdb\u884c\u4e86\u6bd4\u8f83\uff0c\u5728\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u67d0\u4e9b\u65b9\u6cd5\u5728\u6027\u80fd\u65b9\u9762\u8981\u4f18\u4e8e\u5176\u4ed6\u65b9\u6cd5\u3002\u672c\u6587\u5047\u5b9a\u60a8\u5df2\u7ecf\u5177\u5907\u4e00\u5b9a\u7684 ASP \u548c Visual Basic \u7f16\u7a0b\u65b9\u9762\u7684\u77e5\u8bc6\u3002<\/p>\n<h4 class=\"dtH1\">\u76ee\u5f55<\/h4>\n<ul>\n<li>\u7b80\u4ecb<\/li>\n<li>ASP \u8bbe\u8ba1<\/li>\n<li>\u5b57\u7b26\u4e32\u8fde\u63a5<\/li>\n<li>\u5feb\u6377\u7684\u89e3\u51b3\u65b9\u6848<\/li>\n<li>StringBuilder<\/li>\n<li>\u5185\u7f6e\u65b9\u6cd5<\/li>\n<li>\u6d4b\u8bd5<\/li>\n<li>\u7ed3\u679c<\/li>\n<li>\u5c0f\u7ed3<\/li>\n<\/ul>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_intro\"><\/a>\u7b80\u4ecb<\/h2>\n<p>\u7f16\u5199 ASP \u9875\u9762\u65f6\uff0c\u5f00\u53d1\u4eba\u5458\u5b9e\u9645\u4e0a\u662f\u521b\u5efa\u4e00\u4e2a\u683c\u5f0f\u5316\u7684\u6587\u672c\u6d41\uff0c\u901a\u8fc7 ASP \u63d0\u4f9b\u7684 <b>Response<\/b> \u5bf9\u8c61\u5199\u5165 Web \u5ba2\u6237\u7aef\u3002\u521b\u5efa\u6b64\u6587\u672c\u6d41\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u800c\u60a8\u9009\u62e9\u7684\u65b9\u6cd5\u5c06\u5bf9 Web \u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\u4ea7\u751f\u5f88\u5927\u5f71\u54cd\u3002\u5f88\u591a\u6b21\uff0c\u5728\u6211\u5e2e\u52a9\u5ba2\u6237\u4f18\u5316\u5176 Web \u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u65f6\uff0c\u53d1\u73b0\u5176\u4e2d\u4e00\u4e2a\u6bd4\u8f83\u6709\u6548\u7684\u65b9\u6cd5\u662f\u66f4\u6539 HTML \u6d41\u7684\u521b\u5efa\u65b9\u5f0f\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u51e0\u79cd\u5e38\u7528\u6280\u672f\uff0c\u5e76\u6d4b\u8bd5\u5b83\u4eec\u5bf9\u4e00\u4e2a\u7b80\u5355\u7684 ASP \u9875\u9762\u7684\u6027\u80fd\u6240\u4ea7\u751f\u7684\u5f71\u54cd\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_design\"><\/a>ASP \u8bbe\u8ba1<\/h2>\n<p>\u8bb8\u591a ASP \u5f00\u53d1\u4eba\u5458\u90fd\u9075\u5faa\u826f\u597d\u7684\u8f6f\u4ef6\u5de5\u7a0b\u539f\u5219\uff0c\u5c3d\u53ef\u80fd\u5730\u5c06\u5176\u4ee3\u7801\u6a21\u5757\u5316\u3002\u8fd9\u79cd\u8bbe\u8ba1\u901a\u5e38\u4f7f\u7528\u4e00\u4e9b\u5305\u542b\u6587\u4ef6\uff0c\u8fd9\u4e9b\u6587\u4ef6\u4e2d\u5305\u542b\u5bf9\u9875\u9762\u7684\u7279\u5b9a\u4e0d\u8fde\u7eed\u90e8\u5206\u8fdb\u884c\u683c\u5f0f\u5316\u751f\u6210\u7684\u51fd\u6570\u3002\u8fd9\u4e9b\u51fd\u6570\u7684\u5b57\u7b26\u4e32\u8f93\u51fa\uff08\u901a\u5e38\u662f HTML \u8868\u683c\u4ee3\u7801\uff09\u53ef\u4ee5\u901a\u8fc7\u5404\u79cd\u7ec4\u5408\u521b\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u9875\u9762\u3002\u67d0\u4e9b\u5f00\u53d1\u4eba\u5458\u5bf9\u6b64\u65b9\u6cd5\u8fdb\u884c\u4e86\u6539\u8fdb\uff0c\u5c06\u8fd9\u4e9b HTML \u51fd\u6570\u79fb\u5230 Visual Basic COM \u7ec4\u4ef6\u4e2d\uff0c\u5e0c\u671b\u5145\u5206\u5229\u7528\u5df2\u7f16\u8bd1\u7684\u4ee3\u7801\u63d0\u4f9b\u7684\u989d\u5916\u6027\u80fd\u3002<\/p>\n<p>\u5c3d\u7ba1\u8fd9\u79cd\u8bbe\u8ba1\u65b9\u6cd5\u5f88\u4e0d\u9519\uff0c\u4f46\u521b\u5efa\u7ec4\u6210\u8fd9\u4e9b\u4e0d\u8fde\u7eed HTML \u4ee3\u7801\u7ec4\u4ef6\u7684\u5b57\u7b26\u4e32\u6240\u4f7f\u7528\u7684\u65b9\u6cd5\u5c06\u5bf9 Web \u7ad9\u70b9\u7684\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\u4ea7\u751f\u5f88\u5927\u7684\u5f71\u54cd\uff0c\u65e0\u8bba\u5b9e\u9645\u7684\u64cd\u4f5c\u662f\u5728 ASP \u5305\u542b\u6587\u4ef6\u4e2d\u6267\u884c\u8fd8\u662f\u5728 Visual Basic COM \u7ec4\u4ef6\u4e2d\u6267\u884c\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_concat\"><\/a>\u5b57\u7b26\u4e32\u8fde\u63a5<\/h2>\n<p>\u8bf7\u770b\u4ee5\u4e0b <b>WriteHTML<\/b> \u51fd\u6570\u7684\u4ee3\u7801\u7247\u65ad\u3002\u540d\u4e3a Data \u7684\u53c2\u6570\u53ea\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e9b\u8981\u683c\u5f0f\u5316\u4e3a\u8868\u683c\u7ed3\u6784\u7684\u6570\u636e\uff08\u4f8b\u5982\uff0c\u4ece\u6570\u636e\u5e93\u8fd4\u56de\u7684\u6570\u636e\uff09\u3002<\/p>\n<pre class=\"code\">\r\nFunction WriteHTML( Data )\r\nDim nRep\r\nFor nRep = 0 to 99\r\n   sHTML = sHTML &amp; vbcrlf _ \r\n         &amp; &quot;&lt;TR&gt;&lt;TD&gt;&quot; &amp; (nRep + 1) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 0, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 1, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 2, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 3, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 4, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 5, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;\/TR&gt;&quot;\r\nNext\r\nWriteHTML = sHTML\r\nEnd Function\r\n<\/pre>\n<p>\u8fd9\u662f\u5f88\u591a ASP \u548c Visual Basic \u5f00\u53d1\u4eba\u5458\u521b\u5efa HTML \u4ee3\u7801\u65f6\u5e38\u7528\u7684\u65b9\u6cd5\u3002sHTML \u53d8\u91cf\u4e2d\u5305\u542b\u7684\u6587\u672c\u8fd4\u56de\u5230\u8c03\u7528\u4ee3\u7801\uff0c\u7136\u540e\u4f7f\u7528 <b>Response.Write<\/b> \u5199\u5165\u5ba2\u6237\u7aef\u3002\u5f53\u7136\uff0c\u8fd9\u8fd8\u53ef\u4ee5\u8868\u793a\u4e3a\u76f4\u63a5\u5d4c\u5165\u4e0d\u5305\u542b <b>WriteHTML<\/b> \u51fd\u6570\u7684\u9875\u9762\u7684\u7c7b\u4f3c\u4ee3\u7801\u3002\u6b64\u4ee3\u7801\u7684\u95ee\u9898\u662f\uff0cASP \u548c Visual Basic \u4f7f\u7528\u7684\u5b57\u7b26\u4e32\u6570\u636e\u7c7b\u578b\uff08BSTR \u6216 Basic \u5b57\u7b26\u4e32\uff09\u5b9e\u9645\u4e0a\u65e0\u6cd5\u66f4\u6539\u957f\u5ea6\u3002\u8fd9\u610f\u5473\u7740\u6bcf\u5f53\u5b57\u7b26\u4e32\u957f\u5ea6\u66f4\u6539\u65f6\uff0c\u5185\u5b58\u4e2d\u5b57\u7b26\u4e32\u7684\u539f\u59cb\u8868\u793a\u5f62\u5f0f\u90fd\u5c06\u906d\u5230\u7834\u574f\uff0c\u800c\u4e14\u5c06\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u65b0\u5b57\u7b26\u4e32\u6570\u636e\u7684\u65b0\u7684\u8868\u793a\u5f62\u5f0f\uff1a\u8fd9\u5c06\u589e\u52a0\u5206\u914d\u5185\u5b58\u548c\u89e3\u9664\u5206\u914d\u5185\u5b58\u7684\u64cd\u4f5c\u3002\u5f53\u7136\uff0cASP \u548c Visual Basic \u5df2\u4e3a\u60a8\u89e3\u51b3\u4e86\u8fd9\u4e00\u95ee\u9898\uff0c\u56e0\u6b64\u5b9e\u9645\u5f00\u9500\u4e0d\u4f1a\u7acb\u5373\u663e\u73b0\u51fa\u6765\u3002\u5206\u914d\u5185\u5b58\u548c\u89e3\u9664\u5206\u914d\u5185\u5b58\u8981\u6c42\u57fa\u672c\u8fd0\u884c\u65f6\u4ee3\u7801\u89e3\u9664\u5404\u4e2a\u4e13\u7528\u9501\u5b9a\uff0c\u56e0\u6b64\u9700\u8981\u5927\u91cf\u5f00\u9500\u3002\u5f53\u5b57\u7b26\u4e32\u53d8\u5f97\u5f88\u5927\u5e76\u4e14\u6709\u5927\u5757\u5185\u5b58\u8981\u88ab\u5feb\u901f\u8fde\u7eed\u5730\u5206\u914d\u548c\u89e3\u9664\u5206\u914d\u65f6\uff0c\u6b64\u95ee\u9898\u53d8\u5f97\u5c24\u4e3a\u660e\u663e\uff0c\u5c31\u50cf\u5728\u5927\u578b\u5b57\u7b26\u4e32\u8fde\u63a5\u671f\u95f4\u51fa\u73b0\u7684\u60c5\u51b5\u4e00\u6837\u3002\u5c3d\u7ba1\u8fd9\u4e00\u95ee\u9898\u5bf9\u5355\u7528\u6237\u73af\u5883\u7684\u5f71\u54cd\u4e0d\u5927\uff0c\u4f46\u5728\u670d\u52a1\u5668\u73af\u5883\uff08\u4f8b\u5982\uff0c\u5728 Web \u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684 ASP \u5e94\u7528\u7a0b\u5e8f\uff09\u4e2d\uff0c\u5b83\u5c06\u5bfc\u81f4\u4e25\u91cd\u7684\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\u95ee\u9898\u3002<\/p>\n<p>\u4e0b\u9762\uff0c\u6211\u4eec\u56de\u5230\u4e0a\u8ff0\u4ee3\u7801\u7247\u6bb5\uff1a\u6b64\u4ee3\u7801\u4e2d\u8981\u6267\u884c\u591a\u5c11\u4e2a\u5b57\u7b26\u4e32\u5206\u914d\u64cd\u4f5c\uff1f\u7b54\u6848\u662f 16 \u4e2a\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c&ldquo;<code class=\"ce\">&amp;<\/code>&rdquo;\u8fd0\u7b97\u7b26\u7684\u6bcf\u6b21\u5e94\u7528\u90fd\u5c06\u5bfc\u81f4\u53d8\u91cf <code class=\"ce\">sHTML<\/code> \u6240\u6307\u7684\u5b57\u7b26\u4e32\u88ab\u7834\u574f\u548c\u91cd\u65b0\u521b\u5efa\u3002\u524d\u9762\u5df2\u7ecf\u63d0\u5230\uff0c\u5b57\u7b26\u4e32\u5206\u914d\u7684\u5f00\u9500\u5f88\u5927\uff0c\u5e76\u4e14\u968f\u7740\u5b57\u7b26\u4e32\u7684\u589e\u5927\u800c\u589e\u52a0\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u4e0a\u8ff0\u4ee3\u7801\u8fdb\u884c\u6539\u8fdb\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_parens\"><\/a>\u5feb\u6377\u7684\u89e3\u51b3\u65b9\u6848<\/h2>\n<p>\u6709\u4e24\u79cd\u65b9\u6cd5\u53ef\u4ee5\u7f13\u89e3\u5b57\u7b26\u4e32\u8fde\u63a5\u7684\u5f71\u54cd\uff0c\u7b2c\u4e00\u79cd\u65b9\u6cd5\u662f\u5c1d\u8bd5\u51cf\u5c0f\u8981\u5904\u7406\u7684\u5b57\u7b26\u4e32\u7684\u5927\u5c0f\uff0c\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u662f\u5c1d\u8bd5\u51cf\u5c11\u6267\u884c\u5b57\u7b26\u4e32\u5206\u914d\u64cd\u4f5c\u7684\u6570\u76ee\u3002\u8bf7\u53c2\u89c1\u4e0b\u9762\u6240\u793a\u7684 <b>WriteHTML<\/b> \u4ee3\u7801\u7684\u4fee\u8ba2\u7248\u672c\u3002<\/p>\n<pre class=\"code\">\r\nFunction WriteHTML( Data )\r\nDim nRep\r\nFor nRep = 0 to 99\r\n   sHTML = sHTML &amp; ( vbcrlf _ \r\n         &amp; &quot;&lt;TR&gt;&lt;TD&gt;&quot; &amp; (nRep + 1) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 0, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _       \r\n         &amp; Data( 1, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 2, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 3, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 4, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; _ \r\n         &amp; Data( 5, nRep ) &amp; &quot;&lt;\/TD&gt;&lt;\/TR&gt;&quot; )\r\nNext\r\nWriteHTML = sHTML\r\nEnd Function\r\n<\/pre>\n<p>\u4e4d\u4e00\u770b\uff0c\u53ef\u80fd\u5f88\u96be\u53d1\u73b0\u8fd9\u6bb5\u4ee3\u7801\u4e0e\u4e0a\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\u7684\u5dee\u522b\u3002\u5176\u5b9e\uff0c\u6b64\u4ee3\u7801\u53ea\u662f\u5728 <code class=\"ce\">sHTML = sHTML &amp;<\/code> \u540e\u7684\u5185\u5bb9\u5916\u9762\u52a0\u4e0a\u4e86\u62ec\u53f7\u3002\u8fd9\u5b9e\u9645\u4e0a\u662f\u901a\u8fc7\u66f4\u6539\u4f18\u5148\u987a\u5e8f\uff0c\u6765\u51cf\u5c0f\u5927\u591a\u6570\u5b57\u7b26\u4e32\u8fde\u63a5\u64cd\u4f5c\u4e2d\u5904\u7406\u7684\u5b57\u7b26\u4e32\u5927\u5c0f\u3002\u5728\u6700\u521d\u7684\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0cASP \u7f16\u8bd1\u5668\u5c06\u67e5\u770b\u7b49\u53f7\u53f3\u8fb9\u7684\u8868\u8fbe\u5f0f\uff0c\u5e76\u4ece\u5de6\u5230\u53f3\u8fdb\u884c\u8ba1\u7b97\u3002\u7ed3\u679c\uff0c\u6bcf\u6b21\u91cd\u590d\u90fd\u8981\u8fdb\u884c 16 \u4e2a\u8fde\u63a5\u64cd\u4f5c\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u9488\u5bf9\u4e0d\u65ad\u589e\u957f\u7684 <code class=\"ce\">sHTML<\/code> \u8fdb\u884c\u3002\u5728\u65b0\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u63d0\u793a\u7f16\u8bd1\u5668\u66f4\u6539\u64cd\u4f5c\u987a\u5e8f\u3002\u73b0\u5728\uff0c\u5b83\u5c06\u6309\u4ece\u5de6\u5230\u53f3\u3001\u4ece\u62ec\u53f7\u5185\u5230\u62ec\u53f7\u5916\u7684\u987a\u5e8f\u8ba1\u7b97\u8868\u8fbe\u5f0f\u3002\u6b64\u6280\u672f\u4f7f\u5f97\u6bcf\u6b21\u91cd\u590d\u5305\u62ec 15 \u4e2a\u8fde\u63a5\u64cd\u4f5c\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u9488\u5bf9\u7684\u662f\u4e0d\u4f1a\u589e\u957f\u7684\u8f83\u5c0f\u5b57\u7b26\u4e32\uff0c\u53ea\u6709\u4e00\u4e2a\u662f\u9488\u5bf9\u4e0d\u65ad\u589e\u957f\u7684\u5927\u7684 <code class=\"ce\">sHTML<\/code>\u3002\u56fe 1 \u663e\u793a\u4e86\u8fd9\u79cd\u4f18\u5316\u65b9\u6cd5\u4e0e\u6807\u51c6\u8fde\u63a5\u65b9\u6cd5\u5728\u5185\u5b58\u4f7f\u7528\u6a21\u5f0f\u65b9\u9762\u7684\u6bd4\u8f83\u3002<\/p>\n<p class=\"fig\" align=\"center\"><img decoding=\"async\" onclick=\"javascript:window.open(this.src);\" src=\"http:\/\/www.blueidea.com\/articleimg\/2004\/03\/1751\/aspstrcatn01.gif\" width=\"389\" onload=\"return imgzoom(this,550)\" style=\"cursor: pointer\" alt=\"\" \/><\/p>\n<p class=\"label\"><b>\u56fe 1\uff1a\u6807\u51c6\u8fde\u63a5\u4e0e\u52a0\u62ec\u53f7\u8fde\u63a5\u5728\u5185\u5b58\u4f7f\u7528\u6a21\u5f0f\u65b9\u9762\u7684\u6bd4\u8f83<\/b><\/p>\n<p>\u5728\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u62ec\u53f7\u53ef\u4ee5\u5bf9\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\u4ea7\u751f\u5341\u5206\u663e\u8457\u7684\u5f71\u54cd\uff0c\u540e\u6587\u5c06\u5bf9\u6b64\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u8bf4\u660e\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_stringbuilder\"><\/a>StringBuilder<\/h2>\n<p>\u6211\u4eec\u5df2\u7ecf\u627e\u5230\u4e86\u89e3\u51b3\u5b57\u7b26\u4e32\u8fde\u63a5\u95ee\u9898\u7684\u5feb\u6377\u65b9\u6cd5\uff0c\u5728\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u6b64\u65b9\u6cd5\u53ef\u4ee5\u8fbe\u5230\u6027\u80fd\u548c\u6295\u5165\u7684\u6700\u4f73\u5e73\u8861\u3002\u4f46\u662f\uff0c\u5982\u679c\u8981\u8fdb\u4e00\u6b65\u63d0\u9ad8\u6784\u5efa\u5927\u578b\u5b57\u7b26\u4e32\u7684\u6027\u80fd\uff0c\u9700\u8981\u91c7\u7528\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff0c\u5373\u51cf\u5c11\u5b57\u7b26\u4e32\u5206\u914d\u64cd\u4f5c\u7684\u6570\u76ee\u3002\u4e3a\u6b64\uff0c\u9700\u8981\u4f7f\u7528 <b>StringBuilder<\/b>\u3002StringBuilder \u662f\u4e00\u4e2a\u7c7b\uff0c\u7528\u4e8e\u7ef4\u62a4\u53ef\u914d\u7f6e\u7684\u5b57\u7b26\u4e32\u7f13\u51b2\u533a\uff0c\u7ba1\u7406\u63d2\u5165\u5230\u6b64\u7f13\u51b2\u533a\u7684\u65b0\u6587\u672c\u7247\u65ad\uff0c\u5e76\u4ec5\u5728\u6587\u672c\u957f\u5ea6\u8d85\u51fa\u5b57\u7b26\u4e32\u7f13\u51b2\u533a\u957f\u5ea6\u65f6\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u91cd\u65b0\u5206\u914d\u3002Microsoft .NET \u6846\u67b6\u514d\u8d39\u63d0\u4f9b\u4e86\u8fd9\u6837\u4e00\u4e2a\u7c7b (<b>System.Text.StringBuilder<\/b>)\uff0c\u5e76\u5efa\u8bae\u5728\u8be5\u73af\u5883\u4e0b\u8fdb\u884c\u7684\u6240\u6709\u5b57\u7b26\u4e32\u8fde\u63a5\u64cd\u4f5c\u4e2d\u4f7f\u7528\u5b83\u3002\u5728 ASP \u548c\u4f20\u7edf\u7684 Visual Basic \u73af\u5883\u4e2d\uff0c\u6211\u4eec\u65e0\u6cd5\u8bbf\u95ee\u6b64\u7c7b\uff0c\u56e0\u6b64\u9700\u8981\u81ea\u884c\u521b\u5efa\u3002\u4e0b\u9762\u662f\u4f7f\u7528 Visual Basic 6.0 \u521b\u5efa\u7684 <b>StringBuilder<\/b> \u7c7b\u793a\u4f8b\uff08\u4e3a\u7b80\u6d01\u8d77\u89c1\uff0c\u7701\u7565\u4e86\u9519\u8bef\u5904\u7406\u4ee3\u7801\uff09\u3002<\/p>\n<pre class=\"code\">\r\nOption Explicit\r\n' \u9ed8\u8ba4\u7684\u7f13\u51b2\u533a\u521d\u59cb\u5927\u5c0f\u548c\u589e\u957f\u7cfb\u6570\r\nPrivate Const DEF_INITIALSIZE As Long = 1000\r\nPrivate Const DEF_GROWTH As Long = 1000\r\n' \u7f13\u51b2\u533a\u5927\u5c0f\u548c\u589e\u957f\r\nPrivate m_nInitialSize As Long\r\nPrivate m_nGrowth As Long\r\n' \u7f13\u51b2\u533a\u548c\u7f13\u51b2\u533a\u8ba1\u6570\u5668\r\nPrivate m_sText As String\r\nPrivate m_nSize As Long\r\nPrivate m_nPos As Long\r\nPrivate Sub Class_Initialize()\r\n   ' \u8bbe\u7f6e\u5927\u5c0f\u548c\u589e\u957f\u7684\u9ed8\u8ba4\u503c\r\n   m_nInitialSize = DEF_INITIALSIZE\r\n   m_nGrowth = DEF_GROWTH\r\n   ' \u521d\u59cb\u5316\u7f13\u51b2\u533a\r\n   InitBuffer\r\nEnd Sub\r\n' \u8bbe\u7f6e\u521d\u59cb\u5927\u5c0f\u548c\u589e\u957f\u6570\u91cf\r\nPublic Sub Init(ByVal InitialSize As Long, ByVal Growth As Long)\r\n   If InitialSize &gt; 0 Then m_nInitialSize = InitialSize\r\n   If Growth &gt; 0 Then m_nGrowth = Growth\r\nEnd Sub\r\n' \u521d\u59cb\u5316\u7f13\u51b2\u533a\r\nPrivate Sub InitBuffer()\r\n   m_nSize = -1\r\n   m_nPos = 1\r\nEnd Sub\r\n' \u589e\u5927\u7f13\u51b2\u533a\r\nPrivate Sub Grow(Optional MinimimGrowth As Long)\r\n   ' \u521d\u59cb\u5316\u7f13\u51b2\u533a\uff08\u5982\u6709\u5fc5\u8981\uff09\r\n   If m_nSize = -1 Then\r\n      m_nSize = m_nInitialSize\r\n      m_sText = Space$(m_nInitialSize)\r\n   Else\r\n      ' \u53ea\u662f\u589e\u957f\r\n      Dim nGrowth As Long\r\n      nGrowth = IIf(m_nGrowth &gt; MinimimGrowth, \r\n            m_nGrowth, MinimimGrowth)\r\n      m_nSize = m_nSize + nGrowth\r\n      m_sText = m_sText &amp; Space$(nGrowth)\r\n   End If\r\nEnd Sub\r\n' \u5c06\u7f13\u51b2\u533a\u5927\u5c0f\u8c03\u6574\u5230\u5f53\u524d\u4f7f\u7528\u7684\u5927\u5c0f\r\nPrivate Sub Shrink()\r\n   If m_nSize &gt; m_nPos Then\r\n      m_nSize = m_nPos - 1\r\n      m_sText = RTrim$(m_sText)\r\n   End If\r\nEnd Sub\r\n' \u6dfb\u52a0\u5355\u4e2a\u6587\u672c\u5b57\u7b26\u4e32\r\nPrivate Sub AppendInternal(ByVal Text As String)\r\n   If (m_nPos + Len(Text)) &gt; m_nSize Then Grow Len(Text)\r\n   Mid$(m_sText, m_nPos, Len(Text)) = Text\r\n   m_nPos = m_nPos + Len(Text)\r\nEnd Sub\r\n' \u6dfb\u52a0\u4e00\u4e9b\u6587\u672c\u5b57\u7b26\u4e32\r\nPublic Sub Append(ParamArray Text())\r\n   Dim nArg As Long\r\n   For nArg = 0 To UBound(Text)\r\n      AppendInternal CStr(Text(nArg))\r\n   Next nArg\r\nEnd Sub\r\n \r\n' \u8fd4\u56de\u5f53\u524d\u5b57\u7b26\u4e32\u6570\u636e\u5e76\u8c03\u6574\u7f13\u51b2\u533a\u5927\u5c0f\r\nPublic Function ToString() As String\r\n   If m_nPos &gt; 0 Then\r\n      Shrink\r\n      ToString = m_sText\r\n   Else\r\n      ToString = &quot;&quot;\r\n   End If\r\nEnd Function\r\n' \u6e05\u9664\u7f13\u51b2\u533a\u5e76\u91cd\u65b0\u521d\u59cb\u5316\r\nPublic Sub Clear()\r\n   InitBuffer\r\nEnd Sub\r\n<\/pre>\n<p>\u6b64\u7c7b\u4e2d\u4f7f\u7528\u7684\u57fa\u672c\u539f\u5219\u662f\uff0c\u5728\u7c7b\u7ea7\u522b\u5c06\u53d8\u91cf (<code class=\"ce\">m_sText<\/code>) \u7528\u4f5c\u5b57\u7b26\u4e32\u7f13\u51b2\u533a\uff0c\u5e76\u4f7f\u7528 <b>Space$<\/b> \u51fd\u6570\u4ee5\u7a7a\u683c\u5b57\u7b26\u586b\u5145\u6b64\u7f13\u51b2\u533a\u4ee5\u5c06\u5176\u8bbe\u7f6e\u4e3a\u7279\u5b9a\u7684\u5927\u5c0f\u3002\u5982\u679c\u8981\u5c06\u66f4\u591a\u6587\u672c\u4e0e\u73b0\u6709\u6587\u672c\u8fde\u63a5\u5728\u4e00\u8d77\uff0c\u5219\u5728\u68c0\u67e5\u7f13\u51b2\u533a\u7684\u5927\u5c0f\u8db3\u4ee5\u5b58\u653e\u65b0\u6587\u672c\u540e\uff0c\u4f7f\u7528 <b>Mid$<\/b> \u51fd\u6570\u5728\u6b63\u786e\u4f4d\u7f6e\u63d2\u5165\u6587\u672c\u3002<b>ToString<\/b> \u51fd\u6570\u5c06\u8fd4\u56de\u5f53\u524d\u5b58\u50a8\u5728\u7f13\u51b2\u533a\u4e2d\u7684\u6587\u672c\uff0c\u5e76\u5c06\u7f13\u51b2\u533a\u7684\u5927\u5c0f\u8c03\u6574\u4e3a\u80fd\u591f\u5bb9\u7eb3\u6b64\u6587\u672c\u7684\u6b63\u786e\u957f\u5ea6\u3002\u4f7f\u7528 <b>StringBuilder<\/b> \u7684 ASP \u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"code\">\r\nFunction WriteHTML( Data )\r\nDim oSB\r\nDim nRep\r\nSet oSB = Server.CreateObject( &quot;StringBuilderVB.StringBuilder&quot; )\r\n' \u7528\u5927\u5c0f\u548c\u589e\u957f\u7cfb\u6570\u521d\u59cb\u5316\u7f13\u51b2\u533a\r\noSB.Init 15000, 7500\r\nFor nRep = 0 to 99\r\n   oSB.Append &quot;&lt;TR&gt;&lt;TD&gt;&quot;, (nRep + 1), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 0, nRep ), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 1, nRep ), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 2, nRep ), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 3, nRep ), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 4, nRep ), &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;, _ \r\n         Data( 5, nRep ), &quot;&lt;\/TD&gt;&lt;\/TR&gt;&quot;\r\nNext\r\nWriteHTML = oSB.ToString()\r\nSet oSB = Nothing\r\nEnd Function\r\n<\/pre>\n<p>\u4f7f\u7528 <b>StringBuilder<\/b> \u9700\u8981\u4e00\u5b9a\u7684\u5f00\u9500\uff0c\u56e0\u4e3a\u6bcf\u6b21\u4f7f\u7528\u6b64\u7c7b\u65f6\u90fd\u5fc5\u987b\u521b\u5efa\u5b83\u7684\u5b9e\u4f8b\uff0c\u5e76\u4e14\u5728\u521b\u5efa\u7b2c\u4e00\u4e2a\u7c7b\u5b9e\u4f8b\u65f6\u5fc5\u987b\u52a0\u8f7d\u5305\u542b\u6b64\u7c7b\u7684 DLL\u3002\u5bf9 <b>StringBuilder<\/b> \u5b9e\u4f8b\u8fdb\u884c\u989d\u5916\u65b9\u6cd5\u8c03\u7528\u65f6\u4e5f\u9700\u8981\u5f00\u9500\u3002\u4f7f\u7528\u52a0\u62ec\u53f7\u7684&ldquo;<code class=\"ce\">&amp;<\/code>&rdquo;\u65b9\u6cd5\u65f6\uff0c<b>StringBuilder<\/b> \u5982\u4f55\u6267\u884c\u53d6\u51b3\u4e8e\u591a\u4e2a\u56e0\u7d20\uff0c\u5305\u62ec\u8fde\u63a5\u7684\u6570\u76ee\u3001\u8981\u6784\u5efa\u7684\u5b57\u7b26\u4e32\u7684\u5927\u5c0f\u4ee5\u53ca\u9009\u62e9\u7684 StringBuilder \u5b57\u7b26\u4e32\u7f13\u51b2\u533a\u7684\u521d\u59cb\u5316\u53c2\u6570\u7684\u6027\u80fd\u3002\u8bf7\u6ce8\u610f\uff0c\u5728\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u5c06\u7f13\u51b2\u533a\u4e2d\u6240\u9700\u7684\u7a7a\u95f4\u91cf\u4f30\u8ba1\u5f97\u7565\u9ad8\u4e00\u4e9b\u8981\u8fdc\u8fdc\u597d\u4e8e\u8ba9\u5176\u4e0d\u65ad\u589e\u957f\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_responsewrite\"><\/a>\u5185\u7f6e\u65b9\u6cd5<\/h2>\n<p>ASP \u5305\u542b\u4e00\u79cd\u975e\u5e38\u5feb\u6377\u7684\u521b\u5efa HTML \u4ee3\u7801\u7684\u65b9\u6cd5\uff0c\u53ea\u9700\u591a\u6b21\u8c03\u7528 <b>Response.Write<\/b>\u3002<b>Write<\/b> \u51fd\u6570\u4f7f\u7528\u9690\u5f0f\u4f18\u5316\u7684\u5b57\u7b26\u4e32\u7f13\u51b2\u533a\uff0c\u6b64\u7f13\u51b2\u533a\u80fd\u591f\u63d0\u4f9b\u975e\u5e38\u4f18\u79c0\u7684\u6027\u80fd\u7279\u6027\u3002\u4fee\u6539\u540e\u7684 <b>WriteHTML<\/b> \u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"code\">\r\nFunction WriteHTML( Data )\r\nDim nRep\r\nFor nRep = 0 to 99\r\n   Response.Write &quot;&lt;TR&gt;&lt;TD&gt;&quot; \r\n   Response.Write (nRep + 1) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;\r\n   Response.Write Data( 0, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;\r\n   Response.Write Data( 1, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot; \r\n   Response.Write Data( 2, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;\r\n   Response.Write Data( 3, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;\r\n   Response.Write Data( 4, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;TD&gt;&quot;\r\n   Response.Write Data( 5, nRep ) \r\n   Response.Write &quot;&lt;\/TD&gt;&lt;\/TR&gt;&quot;\r\nNext\r\nEnd Function\r\n<\/pre>\n<p>\u867d\u7136\u8fd9\u6bb5\u4ee3\u7801\u5f88\u53ef\u80fd\u4e3a\u6211\u4eec\u63d0\u4f9b\u6700\u4f73\u7684\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\uff0c\u4f46\u5728\u67d0\u79cd\u7a0b\u5ea6\u4e0a\u5df2\u7ecf\u7834\u574f\u4e86\u5c01\u88c5\uff0c\u56e0\u4e3a\u73b0\u5728\u4f1a\u5c06\u51fd\u6570\u5185\u90e8\u7684\u4ee3\u7801\u76f4\u63a5\u5199\u5165 <b>Response<\/b> \u6d41\uff0c\u6240\u4ee5\u8c03\u7528\u4ee3\u7801\u4e27\u5931\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684\u63a7\u5236\u6743\u3002\u53e6\u5916\uff0c\u79fb\u52a8\u6b64\u4ee3\u7801\uff08\u4f8b\u5982\uff0c\u79fb\u5165 COM \u7ec4\u4ef6\uff09\u5c06\u53d8\u5f97\u66f4\u52a0\u56f0\u96be\uff0c\u56e0\u4e3a\u6b64\u51fd\u6570\u4e0e <b>Response<\/b> \u6d41\u5b58\u5728\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_testing\"><\/a>\u6d4b\u8bd5<\/h2>\n<p>\u4e0a\u9762\u63d0\u5230\u7684\u56db\u79cd\u65b9\u6cd5\u5206\u522b\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684 ASP \u9875\u9762\uff08\u5305\u542b\u4e00\u4e2a\u7531\u865a\u62df\u5b57\u7b26\u4e32\u6570\u7ec4\u63d0\u4f9b\u6570\u636e\u7684\u5355\u4e2a\u8868\u683c\uff09\u8fdb\u884c\u4e86\u6d4b\u8bd5\u3002\u6211\u4eec\u4f7f\u7528 Application Center Test&reg; (ACT) \u4ece\u5355\u4e2a\u5ba2\u6237\u7aef\uff08<a rel=\"nofollow\" class=\"wordstyle\" href=\"http:\/\/www.newasp.cn\/\" target=\"_blank\">Windows<\/a>&reg; XP Professional\uff0cPIII-850MHz\uff0c512MB RAM\uff09\u9488\u5bf9 100Mb\/sec <a rel=\"nofollow\" class=\"wordstyle\" href=\"http:\/\/www.newasp.cn\/\" target=\"_blank\">\u7f51\u7edc<\/a>\u4e2d\u7684\u5355\u4e2a\u670d\u52a1\u5668\uff08<a rel=\"nofollow\" class=\"wordstyle\" href=\"http:\/\/www.newasp.cn\/\" target=\"_blank\">Windows<\/a> 2000 Advanced Server\uff0c\u53cc PIII-1000MHz\uff0c256MB RAM\uff09\u6267\u884c\u4e86\u6d4b\u8bd5\u3002ACT \u914d\u7f6e\u4e3a\u4f7f\u7528 5 \u4e2a\u7ebf\u7a0b\uff0c\u4ee5\u6a21\u62df 5 \u4e2a\u7528\u6237\u8fde\u63a5\u81f3\u7f51\u7ad9\u65f6\u7684\u8d1f\u8f7d\u3002\u6bcf\u4e2a\u6d4b\u8bd5\u90fd\u5305\u62ec 20 \u79d2\u9884\u70ed\u65f6\u95f4\u548c\u968f\u540e\u7684 100 \u79d2\u8d1f\u8f7d\u65f6\u95f4\uff0c\u5728\u8d1f\u8f7d\u671f\u95f4\u521b\u5efa\u4e86\u5c3d\u53ef\u80fd\u591a\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\u901a\u8fc7\u66f4\u6539\u4e3b\u8868\u683c\u5faa\u73af\u4e2d\u7684\u91cd\u590d\u6b21\u6570\uff0c\u9488\u5bf9\u4e0d\u540c\u6570\u76ee\u7684\u8fde\u63a5\u64cd\u4f5c\u91cd\u590d\u8fd0\u884c\u6d4b\u8bd5\uff0c\u5982 <b>WriteHTML<\/b> \u51fd\u6570\u4e2d\u7684\u4ee3\u7801\u7247\u65ad\u6240\u793a\u3002\u8fd0\u884c\u7684\u6bcf\u4e2a\u6d4b\u8bd5\u90fd\u4f7f\u7528\u4e0a\u6587\u63d0\u5230\u7684\u56db\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\u6267\u884c\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_results\"><\/a>\u7ed3\u679c<\/h2>\n<p>\u4e0b\u9762\u7684\u4e00\u7cfb\u5217\u56fe\u8868\u663e\u793a\u4e86\u5404\u79cd\u65b9\u6cd5\u5bf9\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u541e\u5410\u91cf\u7684\u5f71\u54cd\uff0c\u4ee5\u53ca ASP \u9875\u9762\u7684\u54cd\u5e94\u65f6\u95f4\u3002\u901a\u8fc7\u8fd9\u4e9b\u56fe\u8868\uff0c\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u5e94\u7528\u7a0b\u5e8f\u652f\u6301\u7684\u8bf7\u6c42\u6570\u76ee\uff0c\u4ee5\u53ca\u7528\u6237\u7b49\u5f85\u9875\u9762\u4e0b\u8f7d\u81f3\u6d4f\u89c8\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002<\/p>\n<p class=\"label\"><b>\u8868 1\uff1a\u4f7f\u7528\u7684\u8fde\u63a5\u65b9\u6cd5\u7f29\u5199\u7684\u8bf4\u660e<\/b><\/p>\n<table class=\"data\">\n<tbody>\n<tr valign=\"top\">\n<th class=\"data\" align=\"left\" width=\"35%\">\u65b9\u6cd5\u7f29\u5199<\/th>\n<th class=\"data\" align=\"left\" width=\"65%\">\u8bf4\u660e<\/th>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"35%\">RESP<\/td>\n<td class=\"data\" width=\"65%\">\u5185\u7f6e <b>Response.Write<\/b> \u65b9\u6cd5<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"35%\">CAT<\/td>\n<td class=\"data\" width=\"65%\">\u6807\u51c6\u8fde\u63a5\uff08&ldquo;<code class=\"ce\">&amp;<\/code>&rdquo;\uff09\u65b9\u6cd5<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"35%\">PCAT<\/td>\n<td class=\"data\" width=\"65%\">\u52a0\u62ec\u53f7\u7684\u8fde\u63a5\uff08&ldquo;<code class=\"ce\">&amp;<\/code>&rdquo;\uff09\u65b9\u6cd5<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"35%\">BLDR<\/td>\n<td class=\"data\" width=\"65%\"><b>StringBuilder<\/b> \u65b9\u6cd5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u6a21\u62df\u5178\u578b ASP \u5e94\u7528\u7a0b\u5e8f\u5de5\u4f5c\u8d1f\u8377\u65b9\u9762\uff0c\u6b64\u6d4b\u8bd5\u4e0e\u5b9e\u9645\u60c5\u51b5\u76f8\u5dee\u751a\u8fdc\uff0c\u4ece\u8868 2 \u4e2d\u53ef\u4ee5\u660e\u663e\u770b\u5230\uff0c\u5373\u4f7f\u91cd\u590d 420 \u6b21\uff0c\u6b64\u9875\u9762\u4ecd\u4e0d\u662f\u7279\u522b\u5927\u3002\u73b0\u5728\u5f88\u591a\u590d\u6742\u7684 ASP \u9875\u9762\u5728\u8fd9\u4e9b\u6570\u5b57\u4e0a\u90fd\u662f\u6bd4\u8f83\u9ad8\u7684\uff0c\u8bbe\u7f6e\u6709\u53ef\u80fd\u8d85\u51fa\u6b64\u6d4b\u8bd5\u8303\u56f4\u7684\u9650\u5236\u3002<\/p>\n<p class=\"label\"><b>\u8868 2\uff1a\u6d4b\u8bd5\u793a\u4f8b\u7684\u9875\u9762\u5927\u5c0f\u548c\u8fde\u63a5\u6570\u76ee<\/b><\/p>\n<table class=\"data\" align=\"center\">\n<tbody>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\"><b>\u91cd\u590d\u6b21\u6570<\/b><\/td>\n<td class=\"data\" width=\"40%\"><b>\u8fde\u63a5\u6570\u76ee<\/b><\/td>\n<td class=\"data\" width=\"32%\"><b>\u9875\u9762\u5927\u5c0f\uff08\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d\uff09<\/b><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">15<\/td>\n<td class=\"data\" width=\"40%\">240<\/td>\n<td class=\"data\" width=\"32%\">2,667<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">30<\/td>\n<td class=\"data\" width=\"40%\">480<\/td>\n<td class=\"data\" width=\"32%\">4,917<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">45<\/td>\n<td class=\"data\" width=\"40%\">720<\/td>\n<td class=\"data\" width=\"32%\">7,167<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">60<\/td>\n<td class=\"data\" width=\"40%\">960<\/td>\n<td class=\"data\" width=\"32%\">9,417<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">75<\/td>\n<td class=\"data\" width=\"40%\">1,200<\/td>\n<td class=\"data\" width=\"32%\">11,667<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">120<\/td>\n<td class=\"data\" width=\"40%\">1,920<\/td>\n<td class=\"data\" width=\"32%\">18,539<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">180<\/td>\n<td class=\"data\" width=\"40%\">2,880<\/td>\n<td class=\"data\" width=\"32%\">27,899<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">240<\/td>\n<td class=\"data\" width=\"40%\">3,840<\/td>\n<td class=\"data\" width=\"32%\">37,259<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">300<\/td>\n<td class=\"data\" width=\"40%\">4,800<\/td>\n<td class=\"data\" width=\"32%\">46,619<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">360<\/td>\n<td class=\"data\" width=\"40%\">5,760<\/td>\n<td class=\"data\" width=\"32%\">55,979<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td class=\"data\" width=\"28%\">420<\/td>\n<td class=\"data\" width=\"40%\">6,720<\/td>\n<td class=\"data\" width=\"32%\">62,219<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"fig\" align=\"center\"><img decoding=\"async\" onclick=\"javascript:window.open(this.src);\" src=\"http:\/\/www.blueidea.com\/articleimg\/2004\/03\/1751\/aspstrcatn02.gif\" width=\"421\" onload=\"return imgzoom(this,550)\" style=\"cursor: pointer\" alt=\"\" \/><\/p>\n<p class=\"label\"><b>\u56fe 2\uff1a\u541e\u5410\u91cf\u7ed3\u679c\u56fe<\/b><\/p>\n<p>\u4ece\u56fe 2 \u7684\u56fe\u8868\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u6b63\u5982\u6211\u4eec\u6240\u9884\u671f\u7684\uff0c\u591a\u91cd <b>Response.Write<\/b> \u65b9\u6cd5 (RESP) \u5728\u6d4b\u8bd5\u7684\u6574\u4e2a\u91cd\u590d\u6d4b\u8bd5\u8303\u56f4\u4e2d\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u6700\u4f73\u7684\u541e\u5410\u91cf\u3002\u4f46\u4ee4\u4eba\u60ca\u8bb6\u7684\u662f\uff0c\u6807\u51c6\u5b57\u7b26\u4e32\u8fde\u63a5\u65b9\u6cd5 (CAT) \u7684\u4e0b\u964d\u5982\u6b64\u5de8\u5927\uff0c\u800c\u52a0\u62ec\u53f7\u7684\u65b9\u6cd5 (PCAT) \u5728\u91cd\u590d\u6267\u884c 300 \u591a\u6b21\u65f6\u6027\u80fd\u4f9d\u65e7\u8981\u597d\u5f88\u591a\u3002\u5728\u5927\u7ea6\u91cd\u590d 220 \u6b21\u4e4b\u5904\uff0c\u5b57\u7b26\u4e32\u7f13\u5b58\u5e26\u6765\u7684\u6027\u80fd\u63d0\u9ad8\u8d85\u8fc7\u4e86 <b>StringBuilder<\/b> \u65b9\u6cd5 (BLDR) \u56fa\u6709\u7684\u5f00\u9500\uff0c\u5728\u8fd9\u4e00\u70b9\u4ee5\u4e0a\uff0c\u5728\u6b64 ASP \u9875\u9762\u4e2d\u4f7f\u7528 StringBuilder \u6240\u9700\u7684\u989d\u5916\u5f00\u9500\u662f\u503c\u5f97\u7684\u3002<\/p>\n<p class=\"fig\" align=\"center\"><img decoding=\"async\" onclick=\"javascript:window.open(this.src);\" src=\"http:\/\/www.blueidea.com\/articleimg\/2004\/03\/1751\/aspstrcatn03.gif\" width=\"420\" onload=\"return imgzoom(this,550)\" style=\"cursor: pointer\" alt=\"\" \/><\/p>\n<p class=\"label\"><b>\u56fe 3\uff1a\u54cd\u5e94\u65f6\u95f4\u7ed3\u679c\u56fe<\/b><\/p>\n<p class=\"fig\" align=\"center\"><img decoding=\"async\" onclick=\"javascript:window.open(this.src);\" src=\"http:\/\/www.blueidea.com\/articleimg\/2004\/03\/1751\/aspstrcatn04.gif\" width=\"421\" onload=\"return imgzoom(this,550)\" style=\"cursor: pointer\" alt=\"\" \/><\/p>\n<p class=\"label\"><b>\u56fe 4\uff1a\u7701\u7565 CAT \u7684\u54cd\u5e94\u65f6\u95f4\u7ed3\u679c\u56fe<\/b><\/p>\n<p>\u56fe 3 \u548c\u56fe 4 \u4e2d\u7684\u56fe\u8868\u663e\u793a\u4e86\u6309&ldquo;\u5230\u7b2c\u4e00\u5b57\u8282\u7684\u65f6\u95f4&rdquo;\u6d4b\u91cf\u7684\u54cd\u5e94\u65f6\u95f4\uff08\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d\uff09\u3002\u56e0\u4e3a\u6807\u51c6\u5b57\u7b26\u4e32\u8fde\u63a5\u65b9\u6cd5 (CAT) \u7684\u54cd\u5e94\u65f6\u95f4\u589e\u52a0\u8fc7\u5feb\uff0c\u6240\u4ee5\u53c8\u63d0\u4f9b\u4e86\u672a\u5305\u62ec\u6b64\u65b9\u6cd5\u7684\u56fe\u8868\uff08\u56fe 4\uff09\uff0c\u4ee5\u4fbf\u5206\u6790\u5176\u4ed6\u65b9\u6cd5\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\u6709\u4e00\u70b9\u503c\u5f97\u6ce8\u610f\uff0c\u591a\u91cd <b>Response.Write<\/b> \u65b9\u6cd5 (RESP) \u548c <b>StringBuilder<\/b> \u65b9\u6cd5 (BLDR) \u968f\u91cd\u590d\u6b21\u6570\u7684\u589e\u52a0\u5448\u73b0\u4e00\u79cd\u8fd1\u4f3c\u7ebf\u6027\u7684\u589e\u957f\uff0c\u800c\u6807\u51c6\u8fde\u63a5\u65b9\u6cd5 (CAT) \u548c\u52a0\u62ec\u53f7\u7684\u65b9\u6cd5 (PCAT) \u5219\u5728\u8d85\u8fc7\u4e00\u5b9a\u7684\u9608\u503c\u4e4b\u540e\u5f00\u59cb\u8fc5\u901f\u589e\u52a0\u3002<\/p>\n<h2 class=\"dtH1\"><a name=\"aspstrcatn_conclusion\"><\/a>\u5c0f\u7ed3<\/h2>\n<p>\u672c\u6587\u7740\u91cd\u8bb2\u8ff0\u4e86\u5982\u4f55\u5728 ASP \u73af\u5883\u4e2d\u5e94\u7528\u4e0d\u540c\u7684\u5b57\u7b26\u4e32\u6784\u5efa\u6280\u672f\uff0c\u8fd9\u4e9b\u5185\u5bb9\u540c\u6837\u9002\u7528\u4e8e\u6240\u6709\u4f7f\u7528 Visual Basic \u4ee3\u7801\u521b\u5efa\u5927\u578b\u5b57\u7b26\u4e32\u7684\u65b9\u6848\uff0c\u4f8b\u5982\u624b\u52a8\u521b\u5efa XML \u6587\u6863\u3002\u4ee5\u4e0b\u539f\u5219\u53ef\u4ee5\u5e2e\u52a9\u60a8\u786e\u5b9a\u54ea\u79cd\u65b9\u6cd5\u6700\u9002\u5408\u60a8\u7684\u9700\u8981\u3002<\/p>\n<ul type=\"disc\">\n<li>\u9996\u5148\u5c1d\u8bd5\u52a0\u62ec\u53f7\u7684&ldquo;<code class=\"ce\">&amp;<\/code>&rdquo;\u65b9\u6cd5\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u73b0\u6709\u4ee3\u7801\u65f6\u3002\u8fd9\u79cd\u65b9\u6cd5\u5bf9\u4ee3\u7801\u7ed3\u6784\u7684\u5f71\u54cd\u5fae\u4e4e\u5176\u5fae\uff0c\u4f46\u60a8\u4f1a\u53d1\u73b0\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u5c06\u663e\u8457\u589e\u5f3a\uff0c\u751a\u81f3\u4f1a\u8d85\u51fa\u9884\u5b9a\u76ee\u6807\u3002<\/li>\n<li>\u5728\u4e0d\u7834\u574f\u6240\u9700\u7684\u5c01\u88c5\u7ea7\u522b\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528 <b>Response.Write<\/b>\u3002\u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u53ef\u4ee5\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5185\u5b58\u5185\u5b57\u7b26\u4e32\u5904\u7406\uff0c\u4ece\u800c\u63d0\u4f9b\u6700\u4f73\u7684\u6027\u80fd\u3002<\/li>\n<li>\u4f7f\u7528 <b>StringBuilder<\/b> \u6784\u5efa\u771f\u6b63\u5927\u578b\u6216\u8fde\u63a5\u6570\u76ee\u8f83\u591a\u7684\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<p>\u5c3d\u7ba1\u60a8\u53ef\u80fd\u672a\u770b\u5230\u672c\u6587\u6240\u793a\u7684\u8fd9\u79cd\u6027\u80fd\u589e\u957f\uff0c\u4f46\u6211\u5df2\u5728\u771f\u5b9e\u7684 ASP Web \u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u4e86\u8fd9\u4e9b\u6280\u5de7\uff0c\u53ea\u9700\u8981\u5f88\u5c11\u7684\u989d\u5916\u6295\u5165\u5c31\u53ef\u4ee5\u5728\u6027\u80fd\u548c\u53ef\u7f29\u653e\u6027\u65b9\u9762\u83b7\u5f97\u5f88\u5927\u7684\u63d0\u9ad8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981\uff1a\u5927\u591a\u6570 Active Server Pages (ASP) \u5e94\u7528\u7a0b\u5e8f\u90fd\u8981\u901a\u8fc7\u5b57\u7b26\u4e32\u8fde\u63a5\u6765\u521b\u5efa\u5448\u73b0\u7ed9\u7528\u6237\u7684 HTML \u683c\u5f0f\u7684\u6570\u636e\u3002\u672c\u6587\u5bf9\u51e0\u79cd\u521b\u5efa\u6b64 HTML \u6570\u636e\u6d41\u7684\u65b9\u6cd5\u8fdb\u884c\u4e86\u6bd4\u8f83\uff0c\u5728\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u67d0\u4e9b\u65b9\u6cd5\u5728\u6027\u80fd\u65b9\u9762\u8981\u4f18\u4e8e\u5176\u4ed6\u65b9\u6cd5\u3002\u672c\u6587\u5047&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-198","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=198"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/198\/revisions"}],"predecessor-version":[{"id":66065,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/198\/revisions\/66065"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=198"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=198"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}