Binsec.String_utilsExtra functions over strings
start_with ~prefix str check if str starts with prefix
replace_chars f s creates a new string where all characters c from s have been replaced by the result of f c
filter p s creates a copy of s containing the characters of s such that p c = true,
fold f acc s computes (f .... (f (f acc s.1) s.2) .... s.n) where n is String.length s - 1 *
lfindi s p retrieves the first index of a character verifying predicate p. None otherwise
remove_char c s creates a copy of s without any occurrence of c
remove_newline s creates a copy of s without the newline character '\n'
lchop n s removes the first n characters of string s. Does nothing if the s is empty. Returns the empty string if n >= String.length s n must be positive.
left n s returns the n leftmost characters of s. n must be positive and smaller than the length of s.
right n s returns the n rightmost characters of s. n must be positive and smaller than the length of s.
size_of_hexstring s computes the size in bits of hexadecimal string s. Unsafe function: it does not fully check that s is a valid hexstring.
split ~sep s splits the string s into substrings, taking the string sep as delimiter and returns the list of substrings.
is_char_printable c returns true if c is a terminal-printable ASCII character
is_hex_char c returns true if c is a character representing a hex number, i.e., 'a'-'z', 'A'-'Z', '0'-'9'.
val pp_hex : Format.formatter -> string -> unitpp_hex s print the hexadecimal representation of stored bytes