Jump to content

Bit from Binary


Recommended Posts

Is there any function to extract bit from Binary?

i need someting like that

0123456701234567012345670123456701234567

0110001111000111110001111100000000100100

Loooking for 29 bits starting at bit 6

answer: 111100011111000111110000000010

I have some idea

First extract the first byte of the binary

$Byte1 = BinaryMid( $Var, 1, 1 )

Second, AndIt to remove the first X not wanting byte

$Byte1 = BitAnd( $Byte1 AND "11111100" ) ok not working but i use binary for clarity :)

This add non significatif 0 at start of the number

But i dont have any idea to remove the signifiant bit at end of the number

BitShift should be the solution but i dont think it work with biger than 32 bits value?

Thanx for your help

Stéphane

Link to comment
Share on other sites

You are confused, and so your post is confusing as well.

Assuming that you have

$a = "0110001111000111110001111100000000100100"

then to get your answer all you need is

$b = StringMid($a, 7, 30)

"be smart, drink your wine"

Link to comment
Share on other sites

You are confused, and so your post is confusing as well.

Assuming that you have

$a = "0110001111000111110001111100000000100100"

then to get your answer all you need is

$b = StringMid($a, 7, 30)

ok i see, i have a Binary data, who contain value and the binary representation of the data is "0110001111000111110001111100000000100100" in need to extract Bit from the midle of this bitfield but its contain into Bytes.

This is not easy to explain

Stéphane

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...