[thelist] Friday Freebie

Scott Dexter sgd at ti3.com
Fri Feb 16 09:59:20 CST 2001

> sgd had given a tip a long time ago on thelist about replacing your
> Response.Write statements with a call to a function called R 
> (or p) that
> takes a string as a parameter and just does a Response.Write 
> of it. Good

Since I'm roadkill under a steamroller at work, this will be a good excuse
for this week's Friday Freebie ;)

<tip type="ASP" title="save some typing with wrapper functions" author="sgd"
email="sgd at thinksafely.org">
get tired of typing "response.write" all the time? --Like so:

response.write "blah blah" & username

Create a little 'wrapper' function that will save you the typing of
"response.write" all over the place. The bonus is that you could make your
code a little more readable:

function Print (byval mesg)
	response.write mesg
end function

so instead of typing the line above, you do:

Print "blah blah" & username

The cool thing (I think so, anyways) is that this way you can tweak the
default Response.Write function to do things like always include a "<BR>" or
a line break (vbNewLine), or what suits your fancy. A poor man's
overloading, if you will.

Actual function I have in use to help me when I need to debug the Old
Fashioned Way (printing shit to the screen):

' the curly braces help me see if mesg is empty
function dbg (byval mesg)
	response.write "{" & mesg & "}<BR>"
end function


More information about the thelist mailing list