Welcome to my ASP Code Website

ASC ASP String Function

The Asc function might seem obscure at first - who wants to know the ascii code for characters? But this actually can become quite important in data processing.

Sure, if you're wondering if a character is the letter A you can just do a straight comparison

if LetterInput = "A" then ...

but there are special characters that can end up in strings that are much harder to test for. The two most notorious are the carriage return and the line feed. These are ascii strings 10 and 13. They can cause all sorts of formatting problems and cause your parsing to go haywire.

To use the Asc function, you feed in a character and it returns the numeric ascii ID of that character.

CodeNum = Asc(LetterInput)
if CodeNum = 10 or CodeNum = 13 then response.write "Invalid Entry"

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