by Jonathan Smith (13 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (2 Votes)
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 =)
Inputs
any string
Code Returns
the bitwise inverse of the string
Side Effects
works ONLY on strings
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