CleanupString

Public Function CleanupString(ByVal InputString As String, Optional ByVal AcceptedCharacters As String = "") As String

Cleans a string by limiting the characters only to the set of specified characters. All other characters are removed.

Dim lGivenTime As String = CleanupString(pGivenTime, "0123456789:ap")