佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > ASP中Split分割字符串函數(shù)的實例用法

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

熱門標簽:電子圍欄 科大訊飛語音識別系統(tǒng) Mysql連接數(shù)設置 阿里云 Linux服務器 服務器配置 銀行業(yè)務 團購網(wǎng)站

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 可選。被返回的子字符串數(shù)目,-1 指示返回所有子字符串。
compare 可選。指示在計算子字符串時使用的比較類型的數(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

您可能感興趣的文章:
  • Perl split字符串分割函數(shù)用法指南
  • php字符串分割函數(shù)explode的實例代碼
  • js split 的用法和定義 js split分割字符串成數(shù)組的實例代碼
  • php+正則將字符串中的字母數(shù)字和中文分割

標簽:衡水 蚌埠 衢州 廣元 萍鄉(xiāng) 大理 棗莊 江蘇

巨人網(wǎng)絡通訊聲明:本文標題《ASP中Split分割字符串函數(shù)的實例用法》,本文關鍵詞  ;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    玉林市| 祁东县| 抚松县| 那坡县| 汕尾市| 阳江市| 新昌县| 汤原县| 馆陶县| 肃宁县| 泸州市| 五台县| 广东省| 麻栗坡县| 英德市| 乌恰县| 青岛市| 新巴尔虎左旗| 多伦县| 涟源市| 尉犁县| 神木县| 阿图什市| 南阳市| 图木舒克市| 鞍山市| 重庆市| 沾化县| 康保县| 太仆寺旗| 昌黎县| 长丰县| 上饶县| 冀州市| 来宾市| 土默特右旗| 门头沟区| 理塘县| 乌兰浩特市| 双桥区| 乳源|