Work with Text
Working with text is probably just as common as working with numbers in most programs. Visual Basic refers to text data as strings and it provides a set of string operators and functions just as it does for math. Since strings and numbers are very different types of data, the nature of operators and functions are very different, as shown by Tables 3-7 and 3-8.
Table 3-7. Visual Basic string operators
|
|
|
Table 3-8. Visual Basic string functions
Task |
Function |
Use to |
---|---|---|
Compare |
|
Change the string comparison rules |
|
Find one string inside of another | |
|
Compare one string to another | |
Convert |
|
Convert a character to its numeric ANSI value |
|
Convert a numeric ANSI value to a character | |
|
Convert a number or a date to a string using a specific format | |
|
Make a string lowercase | |
|
Make a string uppercase | |
|
Change the capitalization, locale, or encoding of a string | |
|
Get the numeric value of a string | |
Arrays |
|
Convert a string to a one-dimensional array |
|
Convert a one-dimensional array to a string | |
Change |
|
Get a number of characters from the left side of the string |
|
Get the length of a string | |
|
Remove spaces from the left side of a string | |
|
Copy one string to another, left-aligning the result | |
|
Get a specified number of characters from within as string | |
|
Search ... |
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.