Extract a substring from a string, starting from the right-most character.
Syntax
Right(string, NumberOfCharacters)
Key
string A string or string expression.
NumberOfCharacters The Number of characters to return
Examples
Dim strDemo
strDemo = Right("The world is everlasting", 11 )
Msgbox strDemo
Returns: "everlasting"
A function to pad out a value with leading zeros:
Function LPad(strValue, intLength)
LPad = Right("00" & strValue, intLength)
End Function
mydemo=LPad(4 2)
wscript.echo mydemo Returns: 04
“Begin at the beginning, the King said, very gravely, and go on till you come to the end: then stop” ~ Lewis Carroll
Related:
Left - Extract a substring from a string
Mid - Extract a substring from a string