Language: RemoveInvalidCharacters catches exceptions
This commit is contained in:
parent
8d1dddb101
commit
850cbb2973
@ -124,26 +124,30 @@ Public Class Utils
|
|||||||
Public Shared Function RemoveInvalidCharacters(pString As String) As String
|
Public Shared Function RemoveInvalidCharacters(pString As String) As String
|
||||||
Dim oResult = pString
|
Dim oResult = pString
|
||||||
|
|
||||||
' Remove all Unicode above Codepoint U+10000
|
Try
|
||||||
oResult = Regex.Replace(oResult, InvalidChars.UnicodeSurrogates, String.Empty)
|
' Remove all Unicode above Codepoint U+10000
|
||||||
|
oResult = Regex.Replace(oResult, InvalidChars.UnicodeSurrogates, String.Empty)
|
||||||
|
|
||||||
' Remove all Emojis (Version 13)
|
' Remove all Emojis (Version 13)
|
||||||
oResult = Regex.Replace(oResult, InvalidChars.Emojis, String.Empty)
|
oResult = Regex.Replace(oResult, InvalidChars.Emojis, String.Empty)
|
||||||
|
|
||||||
' Remove Invalid filename characters
|
' Remove Invalid filename characters
|
||||||
oResult = Regex.Replace(oResult, InvalidChars.Filenames, String.Empty)
|
oResult = Regex.Replace(oResult, InvalidChars.Filenames, String.Empty)
|
||||||
|
|
||||||
' Remove Invalid filename characters
|
' Remove Invalid filename characters
|
||||||
oResult = Regex.Replace(oResult, InvalidChars.Paths, String.Empty)
|
oResult = Regex.Replace(oResult, InvalidChars.Paths, String.Empty)
|
||||||
|
|
||||||
' Remove Uneccessary characters
|
' Remove Uneccessary characters
|
||||||
oResult = Regex.Replace(oResult, "\s{2,}", " ")
|
oResult = Regex.Replace(oResult, "\s{2,}", " ")
|
||||||
oResult = Regex.Replace(oResult, "\.{2,}", ".")
|
oResult = Regex.Replace(oResult, "\.{2,}", ".")
|
||||||
|
|
||||||
' Remove excess space chars
|
' Remove excess space chars
|
||||||
oResult = oResult.Trim()
|
oResult = oResult.Trim()
|
||||||
|
|
||||||
Return oResult
|
Return oResult
|
||||||
|
Catch ex As Exception
|
||||||
|
Return oResult
|
||||||
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user