I have this code :
' Option Explicit
Public Function Clean(Text)
On Error Resume Next
' Dim Chars As ?????????
Chars = Array("\", "/", ":", "*", "?", """", "<", ">", "|")
For Each Replaced In Chars
Text = Replace(Text, Replaced, "")
Next
Clean = CStr(Text)
End Function
But i got an error when use Option Explicit because the Chars is not declared, but what type must i use to dim an array (Dim Chars As ???????)?
Corrected version:
Generally better performing version:
Understanding Variants is important, and one should be especially conscious of using the Variant version of string functions instead of the String-typed versions suffixed with the “$” type decoration.
Most of the time you’ll want to avoid Variants when you can because of performance costs.
This version probably performs even better:
There is no “Char” type in VB6, nor is there any initialization syntax on variable declaration.