![]() |
|
|
Replacing Bad words in a StringBelow are two examples of how to deal with bad words. Example 1 receives text entered into a form textfield called 'txtComments'. The code strips out any bad word(s) that you choose to enter into the array 'badChars'. In this script we have deemed that the words 'rubbish', 'crap' and 'shit' are unacceptable and should be removed. Example 1:
<% Rather than simply just removing the bad word(s) below is a script that will take a bad word such as shit and replace it with s***. The script gets the first letter of the bad word and replaces all the other letters with *. Example 2: <% Function ReplaceBadWords(InputComments) If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site. Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|