VBScript Left 函数
❮ VBScript 参考大全
Left 函数从字符串的左侧返回指定数量的字符。
提示: 使用 Len 函数查找字符串中的字符数。
提示: 还可以查看 Right 函数。
语法
Left(string,length)
参数 | 描述 |
---|---|
string | 必需。要从中返回字符的字符串 |
length | 必需。指定要返回多少个字符。如果设置为 0,则返回空字符串 ("")。如果设置为大于或等于字符串长度的值,则返回整个字符串 |
示例
示例 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
上面代码的输出将是
This is a beaut
显示示例 »
示例 2
返回整个字符串
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
上面代码的输出将是
This is a beautiful day!
显示示例 »
❮ VBScript 参考大全