mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
add CCFormat.{newline,substring}
This commit is contained in:
parent
f294ce1634
commit
fc6682b1c1
2 changed files with 16 additions and 0 deletions
|
|
@ -39,6 +39,11 @@ let nativeint fmt n = Format.fprintf fmt "%nd" n
|
||||||
let string_quoted fmt s = Format.fprintf fmt "\"%s\"" s
|
let string_quoted fmt s = Format.fprintf fmt "\"%s\"" s
|
||||||
let flush = Format.pp_print_flush
|
let flush = Format.pp_print_flush
|
||||||
|
|
||||||
|
let newline = Format.pp_force_newline
|
||||||
|
|
||||||
|
let substring out (s,i,len): unit =
|
||||||
|
string out (String.sub s i len)
|
||||||
|
|
||||||
let list ?(sep=return ",@ ") pp fmt l =
|
let list ?(sep=return ",@ ") pp fmt l =
|
||||||
let rec pp_list l = match l with
|
let rec pp_list l = match l with
|
||||||
| x::((_::_) as l) ->
|
| x::((_::_) as l) ->
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,17 @@ val bool : bool printer
|
||||||
val float3 : float printer (* 3 digits after . *)
|
val float3 : float printer (* 3 digits after . *)
|
||||||
val float : float printer
|
val float : float printer
|
||||||
|
|
||||||
|
val newline : unit printer
|
||||||
|
(** Force newline (see {!Format.pp_force_newline})
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
val substring : (string * int * int) printer
|
||||||
|
(** Print the substring [(s,i,len)], where [i] is the offset
|
||||||
|
in [s] and [len] the number of bytes in the substring.
|
||||||
|
@raise Invalid_argument if the triple [(s,i,len)] does not
|
||||||
|
describe a proper substring.
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val char : char printer (** @since 0.14 *)
|
val char : char printer (** @since 0.14 *)
|
||||||
val int32 : int32 printer (** @since 0.14 *)
|
val int32 : int32 printer (** @since 0.14 *)
|
||||||
val int64 : int64 printer (** @since 0.14 *)
|
val int64 : int64 printer (** @since 0.14 *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue