logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Low Carb: 8:00 PM

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Replace ASP String Function


Replace is a commonly used ASP function that allows you to replace one character or characters in a string with another character or characters.

It takes in three parameters:

* The string variable to operate on
* A character or characters to look for
* A character or characters to replace that with

The original string variable is not altered.

There are MANY reasons to use Replace. One of the most common ones is in fixing email problems when people submit an email address to you. People are notorious for adding extra spaces to the beginning, end or even middle of their email address. Many mailers choke on those extra spaces. So to get rid of all spaces - replacing them with "nothing" - you would use:

RecEmail = Replace(RecEmail, " ", "")

Another common use of replace is to take in a comment that a user has typed in and format it for web reading. Users type in returns, or CHR(13) into their text. However, web browsers of course ignore hard returns so the user's text all mushes together. To change all of those returns with the web command <P> which is the paragraph break, you would use:

UserComment = Replace(UserComment, CHR(13), "<P>")

Now when you display UserComment, there are paragraph breaks to nicely separate the user's paragraphs.

ASP String Functions

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
Add Replace+ASP+String+Function to Twitter Add Replace+ASP+String+Function to Facebook Add Replace+ASP+String+Function to MySpace Add Replace+ASP+String+Function to Del.icio.us Digg Replace+ASP+String+Function Add Replace+ASP+String+Function to Yahoo My Web Add Replace+ASP+String+Function to Google Bookmarks Add Replace+ASP+String+Function to Stumbleupon Add Replace+ASP+String+Function to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor