文章詳情頁(yè)
asp字符串連接符&、多個(gè)字符串相加、字符串拼接類
瀏覽:117日期:2022-06-05 08:15:44
asp中使用&實(shí)現(xiàn)字符串的連接
簡(jiǎn)單字符串連接
response.write "jb51.net"&""
多個(gè)字符串連接
<% 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á)式在線測(cè)試工具"" target=""_blank"">JavaScript正則表達(dá)式在線測(cè)試工具</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中,要拼接字符串的時(shí)候,第一個(gè)用到的絕對(duì)是&,后來(lái)在某次項(xiàng)目中,我發(fā)現(xiàn)在拼接超長(zhǎng)字符串的時(shí)候,使用&的效率極低。使用join拼接字符串可使效率提升幾百倍。
<%
Class appendString
Private arrIndex, arrUbound, arrList()
Private Sub Class_Initialize()
‘分配10長(zhǎng)度
redim arrList(10)
‘當(dāng)前長(zhǎng)度
arrIndex = 0
"每次擴(kuò)展長(zhǎng)度
arrUbound = 10
End Sub
Private Sub Class_Terminate()
"釋放所有數(shù)組,再次使用時(shí),需要重新分配
Erase arrList
End Sub
‘設(shè)置值并動(dòng)態(tài)擴(kuò)展長(zhǎng)度
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("愛(ài)")
StringClass.add("編")
StringClass.add("程")
OutputString = StringClass.getString("") "打印結(jié)果是:我愛(ài)編程
%>
以上就是asp字符串連接符&、多個(gè)字符串相加、字符串拼接類的詳細(xì)內(nèi)容,更多關(guān)于asp字符串連接符的資料請(qǐng)關(guān)注其它相關(guān)文章!
標(biāo)簽:
ASP
相關(guān)文章:
1. PHP使用Swagger生成好看的API文檔2. ASP.NET MVC使用jQuery ui的progressbar實(shí)現(xiàn)進(jìn)度條3. Python3 json模塊之編碼解碼方法講解4. Python 制作查詢商品歷史價(jià)格的小工具5. Python 如何調(diào)試程序崩潰錯(cuò)誤6. Python 利用Entrez庫(kù)篩選下載PubMed文獻(xiàn)摘要的示例7. ASP基礎(chǔ)知識(shí)VBScript基本元素講解8. python使用jenkins發(fā)送企業(yè)微信通知的實(shí)現(xiàn)9. Python sublime安裝及配置過(guò)程詳解10. Python 合并拼接字符串的方法
排行榜

網(wǎng)公網(wǎng)安備