View Full Version : What is the ASP equivalant of Substr

09-29-2005, 11:09 PM
I am having trouble breaking apart a variable into shorter segments. Since there are no delimiters I can't use a Split or at least don't know how to.

The variable is a tracking number which also contains a date - so I want to pull the date out for another use.

So here is an example variable:

I want an end result of:
9/29/2005 (or something similar)

Using cgi I would just substr the varibale into three chunks and recombine - how do I do the same in ASP?

(Additional note - the month will sometimes be 2 digits instead of 1 but I'm sure I can add in that If statement once I learn how to break apart the variable.)

Thanks in advance for an suggestions.

09-29-2005, 11:53 PM
The following example uses the Mid function to return six characters, beginning with the fourth character, in a string:

Dim MyVar
MyVar = Mid("VBScript is fun!", 4, 6) ' MyVar contains "Script".

Hope that helps,

09-30-2005, 03:18 PM
Ah, the ease of the Mid, Left, Right and Len String Functions.

09-30-2005, 03:21 PM
theres an instr function but dont know how much use to you it'd be