文章詳情頁
asp字符串連接符&、多個字符串相加、字符串拼接類
瀏覽:35日期:2022-06-05 08:15:44
asp中使用&實現(xiàn)字符串的連接
簡單字符串連接
response.write "jb51.net"&""
多個字符串連接
<% gettj="<a href=""https://www.jb51.net/tools/zhengze.html"" title=""正則表達(dá)式30分鐘入門教程"" target=""_blank"">正則表達(dá)式30分鐘入門教程</a>"&vbcrlf gettj=gettj&"<a href=""https://www.jb51.net/article/181099.htm"" title=""揭開正則表達(dá)式的神秘面紗(regexlab出品)"" target=""_blank"">揭開正則表達(dá)式的神秘面紗(regexlab出品)</a>"&vbcrlf gettj=gettj&"<a href=""http://tools.jb51.net/regex/javascript/"" title=""JavaScript正則表達(dá)式在線測試工具"" target=""_blank"">JavaScript正則表達(dá)式在線測試工具</a>"&vbcrlf gettj=gettj&"<a href=""https://www.jb51.net/tools/regexsc.htm"" title=""正則表達(dá)式速查表"" target=""_blank"">正則表達(dá)式速查表</a>"&vbcrlf gettj=gettj&"<a href=""https://www.jb51.net/tools/regex.htm"" title=""常用正則表達(dá)式"" target=""_blank"">常用正則表達(dá)式</a>"&vbcrlf response.write gettj %>
不如js中直接+=省心
ASP - 字符串拼接類
在ASP中,要拼接字符串的時候,第一個用到的絕對是&,后來在某次項目中,我發(fā)現(xiàn)在拼接超長字符串的時候,使用&的效率極低。使用join拼接字符串可使效率提升幾百倍。
<% Class appendString Private arrIndex, arrUbound, arrList() Private Sub Class_Initialize() ‘分配10長度 redim arrList(10) ‘當(dāng)前長度 arrIndex = 0 "每次擴(kuò)展長度 arrUbound = 10 End Sub Private Sub Class_Terminate() "釋放所有數(shù)組,再次使用時,需要重新分配 Erase arrList End Sub ‘設(shè)置值并動態(tài)擴(kuò)展長度 Public Default Sub Add(value) arrList(arrIndex) = value arrIndex = arrIndex + 1 if arrIndex > arrUbound then arrUbound = arrUbound + 50 redim preserve arrList(arrUbound) end if End Sub "返回字符串 Public Function getString(splitString) redim preserve arrList(arrIndex - 1) getString = join(arrList,splitString) End Function End Class "調(diào)用方法 Set StringClass = New appendString StringClass.add("我") StringClass.add("愛") StringClass.add("編") StringClass.add("程") OutputString = StringClass.getString("") "打印結(jié)果是:我愛編程 %>
以上就是asp字符串連接符&、多個字符串相加、字符串拼接類的詳細(xì)內(nèi)容,更多關(guān)于asp字符串連接符的資料請關(guān)注其它相關(guān)文章!
標(biāo)簽:
ASP
相關(guān)文章:
1. ASP中if語句、select 、while循環(huán)的使用方法2. ASP中解決“對象關(guān)閉時,不允許操作。”的詭異問題……3. xml中的空格之完全解說4. php bugs代碼審計基礎(chǔ)詳解5. WMLScript的語法基礎(chǔ)6. ASP使用MySQL數(shù)據(jù)庫的方法7. msxml3.dll 錯誤 800c0019 系統(tǒng)錯誤:-2146697191解決方法8. html小技巧之td,div標(biāo)簽里內(nèi)容不換行9. XML入門的常見問題(四)10. ASP動態(tài)網(wǎng)頁制作技術(shù)經(jīng)驗分享
排行榜
