
366
|
Chapter 12: The Language Reference
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Public Class TestClass
Private sampleData As Integer
Private Sub CheckTheData( )
Dim sampleData As String = "abc"
Me.sampleData = 5
MsgBox(sampleData) ' Displays "abc"
MsgBox(Me.sampleData) ' Displays "5"
End Sub
End Class
See Also
MyBase Keyword, MyClass Keyword
Mid Function
Class
Microsoft.VisualBasic.Strings
Syntax
Dim result = String = Mid(str, start[, length])
str (required; String)
The expression from which to return a substring
start (required; Long)
The starting position of the substring
length (optional; Long)
The length of the substring to extract
Description
The Mid function returns a substring of a specified length from a given string.
Usage at a Glance
•Ifstr contains Nothing, Mid returns Nothing.
•Ifstart is greater than the length of str, a zero-length string is returned. An error
occurs if
start is less than zero.
•Iflength is omitted, or if selecting length characters would exceed the length of
the string, all characters from
start to the end of str are returned.
• Use the Len function to determine the total length of str.
• The Mid function corresponds to the String data type’s Substring method. In the
following code, the two assignments to the
twoOnly variable are identical.
Dim twoOnly As String
Dim threeNumbers As String = "One Two Three" ...