SunQuest
 
           Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 9th, 2007, 05:30 PM
urbanmike urbanmike is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Location: Sydney, Australia
Posts: 32 urbanmike User rank is Corporal (100 - 500 Reputation Level)urbanmike User rank is Corporal (100 - 500 Reputation Level)urbanmike User rank is Corporal (100 - 500 Reputation Level)urbanmike User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 48 m 37 sec
Reputation Power: 3
Function to strip multiple characters from string ASP

This function is very handy for stripping special characters out especially before inserting into a database. You have the ability to alter the characters you require removed.

You can change the characters you want to remove in the array and if you add orr remove any simply change the iCounter number accordingly

Code:
<%
Function StripSpecialChar(inFileName)
	dim sOut,strorigFileName,arrSpecialChar,intCounter
	 arrSpecialChar  = Array("%20","%"," ","#","+","(",")","&","$","@","!","*","<",">","?","/","|","\",",","-")
	 strorigFileName = inFileName
	 intCounter = 0

	 Do Until intCounter = 20
	  sOut = replace(strorigFileName,arrSpecialChar(intCounter)  ,"")
	  intCounter = intCounter + 1
	  strorigFileName = sOut
	  'response.write strorigFileName
	 Loop
	 StripSpecialChar = response.write(strorigFileName)
end Function
%>


To call this function simply as follows

Code:
<%
Call StripSpecialChar("I want# to strip+ @specific- characters")
%>
Comments on this post
Shadow Wizard agrees: nice!

Reply With Quote
  #2  
Old January 10th, 2007, 03:18 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,621 Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 13 h 47 m 29 sec
Reputation Power: 1441
--moved to the Code Bank.

Welcome to the forum and thanks for sharing this!

Reply With Quote
  #3  
Old April 28th, 2008, 01:46 PM
foreverforever foreverforever is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 16 foreverforever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 9 sec
Reputation Power: 0
Trying to strip a request.form item

Hi,

Tried using StripSpecialChar on a recordset item, and it worked first time . . . which is a rare event for me . . .

But then I tried using it for a request.form item and the wheels fell off.

What I want to do is strip special characters out of a form field named "message".

Can anyone offer some advice please?

I'm using dreamweaver if that's any help (or hindrance!)

Reply With Quote
  #4  
Old April 28th, 2008, 01:56 PM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,645 mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)mehere User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 3 Weeks 5 Days 18 h 58 m 26 sec
Reputation Power: 1542
please post a thread in the proper forum with your problem. also, please post the code that you're using and indicate what error message you're receiving along with which line of code it is referring to.
__________________
Come JOIN the party!!!

Quote of the Month:
Stupidity: Quitters never win, winners never quit, but those who never win AND never quit are idiots.

Questions to Ponder:
If man evolved from monkeys and apes, why do we still have monkeys and apes?

iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
copyright© 2008 sbenj69

Reply With Quote
  #5  
Old April 29th, 2008, 03:43 AM
foreverforever foreverforever is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 16 foreverforever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 9 sec
Reputation Power: 0
Quote:
Originally Posted by mehere
please post a thread in the proper forum with your problem. also, please post the code that you're using and indicate what error message you're receiving along with which line of code it is referring to.


Sorry about that. A basic amateur mistake x 2. Please feel free to delete this post and my last one.

Thanks.

Reply With Quote
  #6  
Old April 29th, 2008, 07:32 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,621 Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 13 h 47 m 29 sec
Reputation Power: 1441
Quote:
Originally Posted by foreverforever
Sorry about that. A basic amateur mistake x 2. Please feel free to delete this post and my last one.

Thanks.
maybe your mistake can help others.. feel free to share the details.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Handy Function to strip unwanted characters from string ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway