VBScript Right Function
- VBScript Tutorial
- How to Use VBScript
- VBScript Variables
- VBScript Procedures
- VBScript Conditionals
- VBScript Looping
- VBScript Summary
- VBScript Examples
- VBScript Functions
- VBScript Keywords
The Right function returns a specified number of characters from the right side of a string.
Note: Use the Len function to determine the number of characters in a string.
Note: See the Left function for more information.
Syntax
Right(string,length)
| Parameter | Description |
|---|---|
| string | Required. The string from which to return characters. |
| length | Required. Specifies how many characters to return. If set to 0, it returns an empty string (""). If set to greater than or equal to the length of the string, it returns the entire string. |
Examples
Example 1
txt = "This is a beautiful day!" document.write(Right(txt, 10))Output:
tiful day!
Try It YourselfExample 2
Returns the entire string:
txt = "This is a beautiful day!" x = Len(txt) document.write(Right(txt, x))Output:
This is a beautiful day!
Try It Yourself
YouTip