Source

spotlib / lib / xstring.mli

val contains : ?from:int -> needle:string -> string -> bool

val is_prefix : ?from:int -> string -> string -> bool
val is_postfix : string -> string -> bool

val is_prefix' : ?from:int -> string -> string -> string option
(* Same as [prefix] but returns the postfix *)
val is_postfix' : string -> string -> string option
(* Same as [postfix] but returns the prefix *)

val index_from_to : string -> int -> int -> char -> int option
val index_string_from : string -> int -> string -> int (* may raise Not_found *)

val sub_from_to : string -> int -> int -> string

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
val split : (char -> bool) -> string -> string list

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

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

val prefix : int -> string -> string
(** same as take *)

val postfix : int -> string -> string

(** Optionalized *)
val index_opt : string -> char -> int option

val scani_left : 
  (int -> 'a -> char -> [< `Continue of 'a | `Stop of 'a]) 
  -> 'a -> ?from:int -> ?to_:int -> string -> 'a

val foldi_left : 
  (int -> 'a -> char -> [< `Continue of 'a | `Stop of 'a]) 
  -> 'a -> string -> 'a

module Levenshtein : sig
  val dist_non_tco : string -> string -> int
  (* Levenshtein edit distance. 
     * Memoized.
     * Non tail recursive. *)
end

module Pervasives : sig
  val chop_newline : string -> string
  val split_by_newline : string -> string list
end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.