Page

4.7.0- String Manipulation

Created by Brendan Doss.
Last Updated by Joel Bush.  

PublicCategorized as 04. Variables.

Not yet tagged
<< 4.6.2- Script Level VariablesChapter44.7.1- Changing the Case of a String >>

String Manipulation

Having outlined all of the different subtypes of variant available, let's take a look at some of the functions you have available to you, which allow you to operate on the information contained within. String manipulation is a completely new ball game that allows you to glean information from text. For example, if a user's full home address were stored in a string, how would you go about extracting just the house number and street name from the string, while removing all the other extraneous information? Have no fear: VBScript provides a set of functions, which allow you to chop, prune and order strings in any way you like. There are several functions provided; we'll only look at the major ones. These are:

 

  • UCase and LCase
  • Len
  • Left
  • Right
  • Mid
  • InStr
  • LTrim, Rtrim and Trim

Note that if you are familiar with Visual Basic or VBA then you might be familiar with version of the functions LTrim, RTrim and Trim, which are LTrim$, RTrim$ and Trim$. However these variations do not work in VBScript and therefore not in ASP either.

<< 4.6.2- Script Level VariablesChapter44.7.1- Changing the Case of a String >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |