pub fn bytea_position(bytea: &[u8], sub_bytea: &[u8]) -> i32
Expand description
Returns the index of the first occurrence of the specified bytea substring in the input bytea, or zero if the substring is not present.
ยงExample
query I
select position('\x6c6f'::bytea in '\x68656c6c6f2c20776f726c64'::bytea);
----
4
query I
select position('\x6967'::bytea in '\x68696768'::bytea);
----
2
query I
select position('\x64'::bytea in '\x616263'::bytea);
----
0
query I
select position(''::bytea in '\x616263'::bytea);
----
1
query I
select position('\x616263'::bytea in ''::bytea);
----
0