Search Tools Links Login

Return Readable Characters


Visual Basic 6, or VB Classic

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.

Original Author: Dr. John A. Nyhart

Inputs

Text

Returns

Text

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 95 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.