Quote:
Originally Posted by ComStraker
Erm looks like illegal characters problem in Iviewnapper getting a file with "s*d" in the comedy section...by the way am a programmer, I like these programs alot and could help if someone developing them wants contact me.
|
Yes, see the previous page in this forum to get the latest version of the batch downloader (15.81) until
mce does the next fix of iViewNapper.
Code:
' This uses the full list of invalid characters - regex method (FASTEST)
' aesthetics: poor
Function CleanInput(ByVal strIn As String) As String
Dim sb = New StringBuilder()
Dim invalids = System.IO.Path.GetInvalidPathChars().Union(System.IO.Path.GetInvalidFileNameChars())
' Build the regex
sb.Append("[")
For Each c In invalids
sb.Append("\")
sb.Append(c)
Next c
sb.Append("]")
' this is our regex
Dim re = New System.Text.RegularExpressions.Regex(sb.ToString())
' Underscore is safe enough - but ugly
Return re.Replace(strIn, "_")
End Function