Monday, March 16, 2009

Chapter 6 Vocab

Length Property - Stores an integer that represents the number of characters contained in a string, or the numberof elements contained in an array.

TrimStart – Removes one or more characters from the beginning of a string, and then returns a string with the appropriate characters removes.

TrimEnd – Removes one or more characters from the end of a string, and then returns a string with the appropriate characters removed.

Trim Method – Removes on or more characters from the beginning and end of a string, and then returns a string with the appropriate characters removed.

Dim fullName As String

fullName = nameTextBox.Text.TrimStart()

assigns to the fullName variable the contents of the NameTextBox’s Text property, excluding any leading spaces

Remove Method – Removes on or more characters from a string, and then returns a string with the appropriate characters removed.

Dim fullName As String = “John Cober”

nameTextBox.Text = fullName.Remove(0,5)

assigns the string”cober” to the nameTextBox’s Text property

Mid Statement – Replaces a portion of a string with another string.

Dim fullName As String = “Rob Smith”

Mid(fullName, 7, 1) = “y”

Changes the contents of the fullName variable to “Rob Smith”

PadLeft Method – Returns a string with the appropriate characters inserted at the beginning of the string.

PadRight Method – Returns a string with the appropriate characters inserted at the end of the string.

Dim number as integer = 42

Dim outputNumber As String

outputNumber = Convert.ToString(number)

outputNumber = outputNumber.Padleft(5)

assigns” 42” (three spaces and the string”42”) to the outputNumber

variable

Insert Method – Returns a string a string with the appropriate characters inserted.

Dim name As String = “Rob Smith”

Dim fullName As String

fullName = name.Insert(4, “T. “)

No comments:

Post a Comment