最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP中Split分割字符串函數(shù)的實例用法小結(jié)

 更新時間:2025年02月21日 09:36:22   作者:lomo_2019  
本文介紹了ASP中Split函數(shù)的用法,包括語法、參數(shù)和示例,Split函數(shù)用于將字符串分割成子字符串,并返回一個基于0的一維數(shù)組,示例展示了如何使用Split函數(shù)分割字符串并截取所需的部分,感興趣的朋友跟隨小編一起學(xué)習(xí)吧

ASP中Split函數(shù)的用法

分割截取字符串

看幾個例子就能理解了

mystr="1,2,3,4,5"
mystr=split(mystr,",")
for i=0 to ubound(mystr)
response.write mystr(i)
next 
'返回值為123456
mystr="xlei.net/http/student/x/index.asp"
mystr=split(mystr,"/http/student")
for i=0 to ubound(mystr)
response.write mystr(i)
next 
'返回值為xlei.net/x/index.asp
mystr="1批在2批在3批在4批是在5批在"
mystr=split(mystr,"批在")
for i=0 to ubound(mystr)
response.write mystr(i)
next 
'返回值為1234批是在56

描述

返回基于 0 的一維數(shù)組,其中包含指定數(shù)目的子字符串。

語法

Split(expression[, delimiter[, count[, start]]])

Split 函數(shù)的語法有以下參數(shù):

參數(shù) 描述

expression 必選。字符串表達式,包含子字符串和分隔符。如果 expression 為零長度字符串,Split 返回空數(shù)組,即不包含元素和數(shù)據(jù)的數(shù)組。
delimiter 可選。用于標識子字符串界限的字符。如果省略,使用空格 ("") 作為分隔符。如果 delimiter 為零長度字符串,則返回包含整個 expression 字符串的單元素數(shù)組。
count 可選。被返回的子字符串?dāng)?shù)目,-1 指示返回所有子字符串。
compare 可選。指示在計算子字符串時使用的比較類型的數(shù)值。有關(guān)數(shù)值,請參閱“設(shè)置”部分。

設(shè)置

compare 參數(shù)可以有以下值:
常數(shù) 值 描述
vbBinaryCompare 0 執(zhí)行二進制比較。
vbTextCompare 1 執(zhí)行文本比較。
vbDatabaseCompare 2 執(zhí)行基于數(shù)據(jù)庫(在此數(shù)據(jù)庫中執(zhí)行比較)中包含的信息的比較。

引用來自 asp端驗證是否包含非法字符

username=replace(trim(request.form("username")),"'","''")
password=replace(trim(request.form("password")),"'","''")
if instr(username,"%") or instr(username,"#") or instr(username,"?") or instr(username,"|") then
     response.write "<script. language=javascript>alert('您的姓名含有非法字符!');history.back()</script>"
     response.end
     end if
if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
     response.write "<script. language=javascript>alert('您的密碼含有非法字符!');history.back()</script>"
response.end
end if

到此這篇關(guān)于ASP中Split分割字符串函數(shù)的實例用法的文章就介紹到這了,更多相關(guān)Split函數(shù)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

城市| 和平区| 承德县| 隆尧县| 泾川县| 马鞍山市| 巨野县| 雷山县| 察哈| 天台县| 阳东县| 石城县| 禹城市| 南安市| 宣恩县| 榆树市| 且末县| 石柱| 平遥县| 涞水县| 永宁县| 宝鸡市| 耒阳市| 山阴县| 岳池县| 襄垣县| 恩施市| 客服| 渑池县| 托克逊县| 枝江市| 巧家县| 涞源县| 荣成市| 潞西市| 无为县| 马龙县| 太保市| 庆元县| 仙桃市| 娄底市|