Mid ASP String Function

Mid is a commonly used ASP function that allows you to extract characters from the center of a string.

Let's say you have a phone number that is always XXX-XXX-XXXX. You need to get just the middle three digits to run a comparison. You could do:

MiddlePart = Mid(TelNumber, 5, 3)

The first parameter is the string you want to examine. The second number is the starting point, and the third number is the number of characters you want to get. The function returns a string.

If you put in

TelNumber = 123-456-7890


MiddlePart = Mid(TelNumber), 5, 3)

Would have MiddlePart set equal to 456.

ASP String Functions