现在位置: 首页 > VBScript 教程 > 正文

VBScript Right 函数


VBScript 参考手册 完整的 VBScript 参考手册

Right 函数从字符串的右侧返回指定数量的字符。

提示:请使用 Len 函数来确定字符串中的字符数量。

提示:请参阅 Left 函数。

语法

Right(string,length)

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

实例

实例 1

<script type="text/vbscript">

txt="This is a beautiful day!"
document.write(Right(txt,10))

</script>

以上实例输出结果:

tiful day!

尝试一下 »

实例 2

返回整个字符串:

<script type="text/vbscript">

txt="This is a beautiful day!"
x=Len(txt)
document.write(Right(txt,x))

</script>

以上实例输出结果:

This is a beautiful day!

尝试一下 »

VBScript 参考手册 完整的 VBScript 参考手册