VBScript Right function
Right function returns the specified number of characters from the right side of the string.
Tip: Use theLen function to determine the number of characters in a string.
Tip: See Left function.
grammar
Right(string,length)
参数 | 描述 |
---|---|
string | 必需。从其中返回字符的字符串。 |
length | 必需。规定需返回多少字符。如果设置为 0,则返回空字符串("")。如果设置为大于或等于字符串的长度,则返回整个字符串。 |
Examples
Example 1
<script type="text/vbscript">
txt="This is a beautiful day!"
document.write(Right(txt,10))
</script>
txt="This is a beautiful day!"
document.write(Right(txt,10))
</script>
Examples of the above output:
tiful day!
try it"
Example 2
Return the entire string:
<script type="text/vbscript">
txt="This is a beautiful day!"
x=Len(txt)
document.write(Right(txt,x))
</script>
txt="This is a beautiful day!"
x=Len(txt)
document.write(Right(txt,x))
</script>
Examples of the above output:
This is a beautiful day!
try it"
Complete VBScript Reference