Extract a substring from a string, starting from the right-most character.

      Right(string, NumberOfCharacters)

   string              A string or string expression.

   NumberOfCharacters  The Number of characters to return


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 VBScript commands

Left - Extract a substring from a string.
Mid - Extract a substring from a string.

Copyright © 1999-2023 SS64.com
Some rights reserved