Remove special character/Nonnatural character from string/filename
Remove special character/Nonnatural character from string/filename
it's useful to have filename without special characters...
Public Shared Function strip(ByVal str As String) As String
Return Regex.Replace(str, "[\[\]\\\^\$\|\?\*\+\(\)\{\}%,;>
End Function
' Put \ with your character. to include dot use \.
another old method
Public Shared Function strip(ByVal str As String) As String
remove nonnatural characters
Dim intCounter As Integer
Dim arrSpecialChar() As String = {",", "<", ">", ":", "?", """", "/", "{", "[", "}", "]", "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", "|", " ", "\"}
intCounter = 0
Dim i As Integer
For i = 0 To arrSpecialChar.Length - 1
Do Until intCounter = 28
str = Replace(str, arrSpecialChar(i), "")
intCounter = intCounter + 1
Loop
intCounter = 0
Next
Return str
End Function
it's useful to have filename without special characters...
Public Shared Function strip(ByVal str As String) As String
Return Regex.Replace(str, "[\[\]\\\^\$\|\?\*\+\(\)\{\}%,;>
End Function
' Put \ with your character. to include dot use \.
another old method
Public Shared Function strip(ByVal str As String) As String
remove nonnatural characters
Dim intCounter As Integer
Dim arrSpecialChar() As String = {",", "<", ">", ":", "?", """", "/", "{", "[", "}", "]", "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", "|", " ", "\"}
intCounter = 0
Dim i As Integer
For i = 0 To arrSpecialChar.Length - 1
Do Until intCounter = 28
str = Replace(str, arrSpecialChar(i), "")
intCounter = intCounter + 1
Loop
intCounter = 0
Next
Return str
End Function
Comments