Escolar Documentos
Profissional Documentos
Cultura Documentos
Parsing Strings
Strings are one of the most widely used data types, and yet parsing strings is one of the most
mis-understood concepts to Visual Basic programmers. So I will show you how it is done.
You can also use the Instr function just to determine whether a string is present within another
string.
Dim sText As String
Dim lElectronics As Long
sText = "Reynolds Electronics"
If InStr(sText, "Electronics") Then
MsgBox "Found the word 'Electronics'"
Else
MsgBox "Did not find the word 'Electronics'"
End If
Run this code and it should tell you that it found the word Electronics. Now try changing sText to
something else and run it again to see what happens...