Welcome to my ASP Code Website

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

Then

MiddlePart = Mid(TelNumber), 5, 3)

Would have MiddlePart set equal to 456.



Still stuck? Please be sure to Contact Lisa Shea - that's me - and I'm happy to lend a hand. I've been programming in ASP classic for many, many years and can help you get through your coding challenge quickly and easily!

To have an easy to use, easy to read reference on hand as you code, also check out my Intro to ASP Book which comes in both ebook and paperback format.

Thanks for stopping in to my page - and good luck!

ASP String Functions