300 likes | 313 Views
Microsoft Visual Basic 2005: Reloaded Second Edition. Chapter 6 String Manipulation and More Controls. The Insert Method. Insert method : used to insert characters anywhere within a string startIndex argument : specifies where in the string to insert the value
E N D
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 6 String Manipulation and More Controls
The Insert Method • Insert method: used to insert characters anywhere within a string • startIndex argument: specifies where in the string to insert the value • string argument: the string being manipulated • value argument: the character(s) to be inserted Microsoft Visual Basic 2005: Reloaded, Second Edition
The Insert Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Insert Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Insert Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Insert Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Insert Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters • StartsWith method: determines whether a specific sequence of characters occurs at the beginning of a string • EndsWith method: determines whether a specific sequence of characters occurs at the end of a string • subString argument: the sequence of characters to be searched for • StartsWith and EndsWith methods: • Return Boolean values • Perform a case-sensitive search Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Search a String for One or More Characters (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method • Contains method: • Determines if a string contains a specific sequence of characters • Is a method of the String class • subString argument: represents the sequence of characters to be searched for • string argument: the string in which to search Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The Contains Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method • IndexOf method: returns an integer representing the location of a substring within a string • Performs a case-sensitive search • subString argument: sequence of characters to be searched for • string argument: the string to be searched • startIndex argument: the starting position for the search (zero-relative) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
The IndexOf Method (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Accessing Characters Contained in a String • SubString method: accesses any number of characters contained in a string • startIndex argument: index of the first character to be accessed (zero-relative) • string argument: the string containing the characters to be accessed • count argument: number of characters to be accessed Microsoft Visual Basic 2005: Reloaded, Second Edition
Accessing Characters Contained in a String (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Accessing Characters Contained in a String (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Accessing Characters Contained in a String (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition
Accessing Characters Contained in a String (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition