A function to remove the punctuation marks from a string.
Function removePunctuation(str)
'Remove extraneous spaces
Dim regEx, Match, Matches
Set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = True
regEx.Pattern = "\s{2,}"
str = Trim(regEx.Replace(str, " "))
'Remove the space between the end of a word and a punctuation mark
regEx.Pattern = "(\!|\.|\?|\;|\,|\:,|\&,|\_,|\{,|\},|\[,|\],|\(,|\),|\(,|\),|\~,|\#)"
removePunctuation = regEx.Replace(str, "")
End Function
The function should be called as:
strValue = removePunctuation(strString)
| This article viewed: 2390 times | Back |
Copyright © 2004-2007 Janet Systems Ltd.