Working with Strings as Arrays
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
It might be hard to believe, but some of the most exciting features in Microsoft® Visual Basic® for Applications (VBA) in Microsoft® Office XP are the functions for working with strings as arrays. These functions can turn once-lengthy string-manipulation procedures into just a few lines of code. And in many cases, they're faster than using loops and string-parsing techniques to work with the contents of a very large string.
In This Section
- The Split Function
Use the Split function to take a string and convert it into an array of strings. - The Join Function
Use the Join function to concatenate the elements of the array together into a single string. - The Filter Function
Search a string array for all elements that match a given text string using one of three arguments — a string array, a string containing the text to find, or a constant specifying the string-comparison method
Related Sections
- Working with Strings
Understand how to get information from strings. - Comparing Strings
Compare strings to determine whether they contain equivalent characters and how they differ if they do not match. - Calculating String Length
Determine the length of a string using the Len function to parse its contents. - Searching a String
Search strings to find out whether they contain a particular character or group of characters by using the InStr or InStrRev functions. - Returning Portions of a String
Learn how to parse the string to be able to work with part of a string's contents. - Finding and Replacing Text Within a String
Find and replace all occurrences of a substring within a string using the Replace function. - Converting Text in a String from One Case to Another
Use the Microsoft® Visual Basic® for Applications (VBA) StrConv function to convert text in a string from one case to another. - Working with String Variables
Understand how to dimension a variable, assign a value to it, and output that variable as part of a string.