Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions content/commands/bitpos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,25 @@ Non-existent keys are treated as empty strings.

## Examples

{{% redis-cli %}}
SET mykey "\xff\xf0\x00"
BITPOS mykey 0
SET mykey "\x00\xff\xf0"
BITPOS mykey 1 0
BITPOS mykey 1 2
BITPOS mykey 1 2 -1 BYTE
BITPOS mykey 1 7 15 BIT
set mykey "\x00\x00\x00"
BITPOS mykey 1
BITPOS mykey 1 7 -3 BIT
{{% /redis-cli %}}

```redis
redis> SET mykey "\xff\xf0\x00"
OK
redis> BITPOS mykey 0
(integer) 12
redis> SET mykey "\x00\xff\xf0"
OK
redis> BITPOS mykey 1 0
(integer) 8
redis> BITPOS mykey 1 2
(integer) 16
redis> BITPOS mykey 1 2 -1 BYTE
(integer) 16
redis> BITPOS mykey 1 7 15 BIT
(integer) 8
redis> set mykey "\x00\x00\x00"
OK
redis> BITPOS mykey 1
(integer) -1
redis> BITPOS mykey 1 7 -3 BIT
(integer) -1
```
Loading