In just a few more days, it will be one year since I started this blog. Next week Saturday I plan to mark the occasion by sharing with you, one of my most favorite functions. In the weeks following that, I'll be bringing you some larger functions and function libraries which will hopefully make up for some of the less interesting things I've posted over the past year. Unfortunately I can't promise no more boring code, because eventually the good stuff will run out.
If I'm going to be completely honest, some of the functions I've posted here, I wrote specifically for here. The tag line of this blog purports "Practical examples for real-world progrmaming", and I feel that sometimes I wasn't really living up to that. However, I feel to a certain extent that I lived up to what I resolved not to do, which was post silly examples about animals and cars just to illustrate how code works.
Since this is Saturday, I owe you folks some source code. Since next week's code is going to super awesome, I'm going to shamefully post two quick snippets which might seem lackluster, but these were honestly written out of desire/need. Both are re-creations of PHP functions, requested by a PHP programmer that worked for me and had to code in ASP because that's what the existing code was written in.
First we have the echo() function. Our PHP programmer friends are spoiled with not having to type
Response.Write every time they want to put something on the screen. Then again, are we not entitled to the same luxuries? Rather than merely aliasing
Response.Write, you can also use
\n instead of typing
Response.Write Replace(someText, "\n", vbCrLf)
Our second function for today was written for use with HTML's
textarea element and SQL data types that contain text with line breaks.
nl2br = Replace(someText, vbCrLf, "<br />")