VBScript Basics, Part 42 | Mid – Split – InStr

VBScripting (.vbs) Basic tutorial on how to use the Mid function, the Split function, and the InStr function.

Mid(string, start, length)
Split(string, delimiter, count)
InStr(start, string1, string2)

Code Example:

Option Explicit
Dim message, i, mArray
message = “Hey Jim. How are you? I’m good. So is my lamp. Jim”

MsgBox Mid(message, 5,3)

If InStr(InStr(message, “How”), message, “Jim”) Then
MsgBox “yes”
MsgBox “no”
End If

mArray = Split(message)
For i = 0 To UBound(mArray)
MsgBox mArray(i)

Leave a Comment