Documentation
¶
Index ¶
- func FirstIndex(tokens [][]byte, target []byte) (uint32, bool)
- func ForwardSearch(data []byte, from uint32, sep []byte) (uint32, bool)
- func LimitLines(data []byte, limit uint32) ([]byte, error)
- func LimitReverseLines(data []byte, limit uint32) ([]byte, error)
- func ReverseSearch(data []byte, from uint32, sep []byte) (uint32, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstIndex ¶
FirstIndex searches for the first occurrence of a byte in a byte slice.
Parameters:
- tokens: the byte slice to search in.
- target: the byte to search for.
Returns:
- uint32: the index of the first occurrence of the byte in the byte slice, or 0 if not found.
- bool: true if the byte was found, false otherwise.
Panics:
- common.ErrMaxSizeExceeded: if the length of the slice is greater than common.MaxSliceSize.
func ForwardSearch ¶
ForwardSearch searches for the first occurrence of a byte in a byte slice.
Parameters:
- data: the byte slice to search in.
- from: the index to start the search from.
- sep: the byte to search for.
Returns:
- uint32: the index of the first occurrence of the byte in the byte slice, or 0 if not found.
- bool: true if the byte was found, false otherwise.
Panics:
- common.ErrMaxSizeExceeded: if the length of the slice is greater than common.MaxSliceSize.
func LimitLines ¶
LimitLines is a function that limits the lines of the data.
Parameters:
- data: The data to limit.
- limit: The limit of the lines.
Returns:
- []byte: The limited data.
- error: An error if limiting fails.
Errors:
- common.ErrMaxSizeExceeded: If the size of the data is greater than common.MaxSliceSize.
func LimitReverseLines ¶
LimitReverseLines is a function that limits the lines of the data in reverse order.
Parameters:
- data: The data to limit.
- limit: The limit of the lines.
Returns:
- []byte: The limited data.
- error: An error if limiting fails.
Errors:
- common.ErrMaxSizeExceeded: If the size of the data is greater than common.MaxSliceSize.
func ReverseSearch ¶
ReverseSearch searches for the last occurrence of a byte in a byte slice.
Parameters:
- data: the byte slice to search in.
- from: the index to start the search from.
- sep: the byte to search for.
Returns:
- uint32: the index of the last occurrence of the byte in the byte slice, or 0 if not found.
- bool: true if the byte was found, false otherwise.
Panics:
- common.ErrMaxSizeExceeded: if the length of the slice is greater than common.MaxSliceSize.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.