Author Topic: Split ASP String Function  (Read 4726 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
Split ASP String Function
« on: December 20, 2009, 03:00:36 PM »
Are you trying to break a string up into smaller pieces? ASP provides an easy to use split function which lets you dice and slice a string.

Let's say you take in a sentence and want to put each word into a different variable. So you take in

NameStr = "Mr. John Smith"

Set up the array to hold the results with

Dim WordArray

then do the split, using a space as the split indicator

WordArray = Split(NameStr, " ")

Now WordArray(0) is equal to "Mr.", WordArray(1) is equal to "John" and WordArray(2) is equal to "Smith"! You can use various array functions and other string functions to work with these results.