VBScript RightFunction
Complete VBScript Reference
The Right function returns a specified number of characters from the right side of a string.
Tip:Use the Len function to determine the number of characters in a string.
Tip:See the Left function.
Syntax
Right(string,length)
| Parameters | Description |
|---|---|
| string | Required. The string from which to return characters. |
| length | Required. Specifies how many characters to return. If set to 0, an empty string ("") is returned. If set to greater than or equal to the length of the string, the entire string is returned. |
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>
Output of the above example:
tiful day!
Try it Yourself »
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>
Output of the above example:
This is a beautiful day!
Try it Yourself »
Complete VBScript Reference Other Extensions