Working with Strings
Microsoft® Windows® 2000 Scripting Guide
Many system administration scripts are designed to return information about managed items, including such things as the services running on a remote server, the hardware installed on a client workstation, or the events recorded in the event logs on a domain controller. Much of the information returned from these managed objects comes back in the form of string data, data composed of any combination of alphabetic and numeric values. For example, if you query an event log for information about an event description, you might get back a string similar to this:
Security policy in the Group policy objects has been applied successfully.
In other words, there is nothing particularly special about strings; strings are just bits of text, the same kind of text you create when typing in a text editor.
Although strings are a simple enough concept, working with string data can be tricky, especially when 1) that data is returned from a COM object and 2) you need to store that data in a database or display it on the screen. This is because you have no control over how the returned data is packaged; it might be oddly formatted (for example, all uppercase letters), or it might be too long or too short to fit the allocated space. (For example, your database field might be sized to accept no more than 20 characters, but the returned string might contain 30 characters.)
Because of this, it is important for you to be able to manipulate string data; you might want to shorten (or, in some cases, lengthen) the size of a string, you might want to reformat a string, and sometimes you might even want to search within a string and extract only a specified portion of the text. To help you carry out these tasks, VBScript provides a number of functions for manipulating strings.