ASP取出左边字符函数

ASP取出左边字符函数
比如取出6个字符

使用ASP中的Left 函数


定义:

Left 函数可从字符串的左侧返回指定数目的字符。


语法:

Left(string,length)

参数string:必需的。从其中返回字符的字符串。

参数length:必需的。规定需返回多少字符。如果设置为 0,则返回空字符串("")。如果设置为大于或等于字符串的长度,则返回整个字符串。



例子 1

dim txt
txt="This is a beautiful day!"
response.write Left(txt,11)

输出:

This is a b


例子 2

dim txt
txt="This is a beautiful day!"
response.write Left(txt,100)

输出:

This is a beautiful day!


例子 3

dim txt,x
txt="This is a beautiful day!"
x=Len(txt)
response.write Left(txt,x)

输出:

This is a beautiful day!

温馨提示:内容为网友见解,仅供参考
第1个回答  2009-02-16
left(字符串,长度)本回答被提问者采纳
相似回答