VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the binary inverse of a string

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

Rate Get the binary inverse of a string

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

Download this snippet    Add to My Saved Code

Get the binary inverse of a string Comments

No comments have been posted about Get the binary inverse of a string. Why not be the first to post a comment about Get the binary inverse of a string.

Post your comment

Subject:
Message:
0/1000 characters