View Full Version : What is the ASP equivalant of Substr

09-30-2005, 12:09 AM
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-30-2005, 12:53 AM
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, 04:18 PM
Ah, the ease of the Mid, Left, Right and Len String Functions.

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