views:

178

answers:

2

hi,

I want to identify special characters and remove that special characters from my string or a word

for example

  1. O'neil - i want to remove (') from this word.

  2. Muñoz, A. Patrick - i want to remove above character of n (ñ)

similarly i want to remove all special characters from my strings.

I want to do this in asp

How can i do this

A: 

dim line as string="Test 'value' "

line = line.Replace("'"c,String.Empty)

eschneider
A: 

You could use a regular expression and then run the following. You'll need to change the regular expression accordingly.

Const PATTERN = "\W"
Dim objRegEx
Dim strReplacedString : strReplacedString = ""
Set objRegEx= New RegExp 
objRegEx.Pattern = PATTERN 
objRegEx.IgnoreCase = True 
objRegEx.Global = True 
strReplacedString = objRegEx.Replace(strToProcess,"")
Set objRegEx = Nothing
Simmo