by Dr. John A. Nyhart (2 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)
This small function will strip out the unreadable
characters and return readable characters in a string.
This works great for stripping thoes little boxes
out of the text that you just snagged from a web page.
I know that a lot of you have used my code,
but have not voted. It would be nice to see
some feedback in the form of a vote. Thanks.
Inputs
Text
Code Returns
Text
Function ReturnReadableChrsOnly(sString As String) As String
Dim lCount As Long
Dim lPoint As Long
Dim sTmp As String
Dim sChr As String
lCount = Len(sString) ' Get a count of chars
For lPoint = 1 To lCount ' Loop through that count
sChr = Mid(sString, lPoint, 1) ' Get one chr
Select Case Asc(sChr) ' Set a case for the ASCII value of char
Case 32 To 126 ' Is this an Readable Char?
sTmp = sTmp & sChr ' If yes then append to list
End Select '»Select Case Asc(sChr)
Next '»For lPoint = 1 To lCount
ReturnReadableChrsOnly = sTmp
End Function