cheuschober
Muse of Fire
- Local time
- Today, 17:12
- Joined
- Oct 25, 2004
- Messages
- 168
Well, here it is folks--my first official foray into a piece of my own code... and it flopped with an 'Expected: )' error!
But, I can feel how close I am and though I'd ask around for a little help.
Basically, I'm trying to create a function that will evaluate a list of special characters and remove them from my string field.
Example: delspec("8$5AD%Q#F","%$#/.'")
Output: 85ADQF
Here is how far I've gotten! Any help would be greatly appreciated!
Thanks,
~Chad
Basically, I'm trying to create a function that will evaluate a list of special characters and remove them from my string field.
Example: delspec("8$5AD%Q#F","%$#/.'")
Output: 85ADQF
Here is how far I've gotten! Any help would be greatly appreciated!
Code:
Public Function delspec(ByVal scrubstring As String, ByVal spec As String) As Variant
Dim strSpecs As String, bytSpecLen As Byte, n1 As Byte
strSpecs = LTrim(RTrim(spec))
bytSpecLen = Len(strSpecs)
Dim strHold As String, intScrubLen As Integer, n2 As Integer
scrubstring = RTrim(scrubstring)
intScrubLen = Len(scrubstring)
scrubstring = ""
For n1 = 1 To bytSpecLen
For n2 = 1 To intScrubLen
scrubstring = scrubstring & IIf((Mid(scrubstring, n2, 1)) <> (Mid(spec, n1, 1)), Mid(scrubstring, n2, 1), "")
Next n2
Next n1
delspec = scrubstring
End Function
Thanks,
~Chad
Last edited: