Author: cmt9000 | Posted on: 10/30/2009 8:45:08 AM | Views : 1160

Hi,
 
I have a textbox, and I need to check to make sure it doesn't contain certain characters.  I have written code, and it works, but it looks awful.  Is there a better, more elegant way to write this?
Here it is
Public Shared Function cleanCaseName(ByVal caseName As String) As String If caseName <> "" Then caseName = caseName.Replace("--", "") caseName = caseName.Replace("-", "") caseName = caseName.Replace("__", "") caseName = caseName.Replace("#", "") caseName = caseName.Replace("@", "") caseName = caseName.Replace("!", "") caseName = caseName.Replace("^", "") caseName = caseName.Replace("$", "") ...

Go to the complete details ...