Source

spotlib / lib / xstring.mli

val is_prefix : ?from:int -> prefix:string -> string -> bool
val is_postfix : postfix:string -> string -> bool
val index_from_to : string -> int -> int -> char -> int option
val index_string_from : string -> int -> string -> int (* may raise Not_found *)

val chop_newline : string -> string
(** [chop_newline s] returns the string [s] w/o the newline chars at the end.
    [chop_newline "hello\r\n" = "hello"]
    [chop_newline "hello\n" = "hello"]
    [chop_newline "hello" = "hello"]
*)

val make1 : char -> string
(** [make1 = String.make 1] *) 

val split_by_newline : string -> string list

module Set : Xset.S with type elt = String.t

module Open : sig
  val chop_newline : string -> string
  val split_by_newline : string -> string list
end

(** Haskelish string sub *)
val split_at : int -> string -> string * string
val take : int -> string -> string
val drop : int -> string -> string