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.

Syntax:
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”
Else
MsgBox “no”
End If

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


Leave a Comment