ASP中Split函数的用法
分割截取字符串
看几个例子就能理解了
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 的一维数组,其中包含指定数目的子字符串。
语法
Split(expression[, delimiter[, count[, start]]])
Split 函数的语法有以下参数:
参数 描述
expression 必选。字符串表达式,包含子字符串和分隔符。如果 expression 为零长度字符串,Split 返回空数组,即不包含元素和数据的数组。
delimiter 可选。用于标识子字符串界限的字符。如果省略,使用空格 ("") 作为分隔符。如果 delimiter 为零长度字符串,则返回包含整个 expression 字符串的单元素数组。
count 可选。被返回的子字符串数目,-1 指示返回所有子字符串。
compare 可选。指示在计算子字符串时使用的比较类型的数值。有关数值,请参阅“设置”部分。
设置
compare 参数可以有以下值:
常数 值 描述
vbBinaryCompare 0 执行二进制比较。
vbTextCompare 1 执行文本比较。
vbDatabaseCompare 2 执行基于数据库(在此数据库中执行比较)中包含的信息的比较。
引用来自 asp端验证是否包含非法字符
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
树莓派从无屏开机到VNC连接桌面 1、烧录镜像 2、修改boot下的config.txt文件 3、...
jsp中设置cookie如果不设置路径,会出现cookie丢失问题 Cookie cookie = new Coo...
ASP: 复制代码 代码如下: % Option Explicit Response.Buffer = true Response.C...
背景 该问题来自某客户,据描述,他们在部署 MySQL 主从复制时,有时候仅在主库...
Java对象创建过程中构造方法到底做了什么 下面展示一些 代码 。 class Person{ p...
本文是Redis集群学习的实践总结(基于Redis 6.0+),详细介绍逐步搭建Redis集群...
MySQL表的增删改查基础 1. 新增(Create) 1.1 单行数据 全列插入 1.2 多行数据 指...
背景 最近,听到很多吐槽:看到源码,心中就感到十分纠结、特别烦恼。 为什么纠...
%@ LANGUAGE="VBscript" % html head meta NAME="GENERATOR" Content="Microsoft...
在我们这个XML指南里,我们把焦点放在InternetExplorer5.0及其以后的版本上。 We...