package binsec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Binsec_base.String_utilsSource

Extra functions over strings

Sourceval replace_chars : (char -> string) -> string -> string

replace_chars f s creates a new string where all characters c from s have been replaced by the result of f c

Sourceval reverse : string -> string

reverse s creates a new reversed version of s

Sourceval filter : (char -> bool) -> string -> string

filter p s creates a copy of s containing the characters of s such that p c = true,

Sourceval lfindi : string -> (char -> bool) -> int option

lfindi s p retrieves the first index of a character verifying predicate p. None otherwise

Sourceval remove_char : char -> string -> string

remove_char c s creates a copy of s without any occurrence of c

Sourceval remove_newline : string -> string

remove_newline s creates a copy of s without the newline character '\n'

Sourceval lchop : int -> string -> string

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.

Sourceval left : int -> string -> string

left n s returns the n leftmost characters of s. n must be positive and smaller than the length of s.

Sourceval right : int -> string -> string

right n s returns the n rightmost characters of s. n must be positive and smaller than the length of s.

Sourceval size_of_hexstring : string -> int

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.

Sourceval contains : pattern:string -> string -> bool

contains ~pattern s return true if pattern is a substring of s

Sourceval char_codes : string -> int array

Character functions

Sourceval is_char_printable : char -> bool

is_char_printable c returns true if c is a terminal-printable ASCII character

Sourceval is_hex_char : char -> bool

is_hex_char c returns true if c is a character representing a hex number, i.e., 'a'-'z', 'A'-'Z', '0'-'9'.

Sourceval to_hex : string -> string

to_hex s return the hexadecimal representation of stored bytes

Sourceval pp_hex : Format.formatter -> string -> unit

pp_hex s print the hexadecimal representation of stored bytes