...

View Full Version : What is the ASP equivalant of Substr



zenweezil
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:
200592915368

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.

Basscyst
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,
Basscyst

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum