VBScript Basics, Part 9 | Len – Left – Right


VBScripting (.vbs) Basic tutorial on how to use the len, left, and right function. Len which converts your string into a numeric value, and Left which allows you to save characters of a string from left too right, as well as right which goes the other way.

Code Example:
______________________________________________________

Option Explicit
Dim a, b

a= “I love cats”
b= “dogs are stupid”

msgbox Left(a,7) & Left(b,5) & Right(a,4) & Right(b,11)

msgbox “there is ” & Len(a) + Len(b) & ” characters in this string.”
______________________________________________________

Know the Basics:
——————————————————————————————
Len(string) = # of characters in a string.
Left(string, #) = keep characters from left too right.
Right(string, #) = keep characters from right too left.
——————————————————————————————



Leave a Comment