README.md

December 4, 2022 ยท View on GitHub

Get the binary inverse of a string

Description

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 =)

More Info

any string

the bitwise inverse of the string

works ONLY on strings

Submitted On
ByJonathan Smith
LevelIntermediate
User Rating5.0 (10 globes from 2 users)
CompatibilityVB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)
CategoryString Manipulation
WorldVisual Basic
Archive File

Source 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