Tools Links Login

Get the binary inverse of a string

This code is the equivalence of the bitwise complement C opertator (~), except this only works on strings. I got tired of not having this capability, so I wrote it =)

Original Author: Ultimatum

Inputs

any string

Returns

the bitwise inverse of the string

Side Effects

works ONLY on strings

Code

Public Function BinaryInverse(ByVal szData As String)
  Dim szRet As String
  szRet = Space$(Len(szData))
  For i = 1 To Len(szData)
    Mid(szRet, i, 1) = Chr$(255 - Asc(Mid(szData, i, 1)))
  Next i
  BinaryInverse = szRet
  
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 82 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.