Sfairadora

  • Reference Guide

find_bytes_back

find_bytes_back(bin, substr)
find_bytes_back(bin, pos, substr)
Finds the first occurrence of the substr data in the bin data from the end and returns its index. If the parameter pos is specified, the data is searched from that index.
The function returns the index of the first occurrence of the data being searched. The index of the first byte in the string is 0. If pos is negative, its value is considered 0. If the data is not found, an error is returned. This condition can be handled, for instance, using the try statement. If pos is beyond the end of the bin data or is not specified, the whole data is searched.
Note: this function serves to search binary data. To serach a string, use the analogical function find_str_back.

Parameters

bin
The data in which to search. The Binary type.
substr
The data to be searched. The Binary type.
pos pos
Position where begin searching. Type Int. The value 0 denotes the beginning of the data.

Return Value

The function returns the index of the first occurrence found (the Int type) or an error.

See Also