package yocaml

  1. Overview
  2. Docs

As Wordpress is mainly used to move files, having some functions to work with file names can be a very good idea!

type t = string

Describing a filepath.

val into : t -> t -> t

t |> into dir describes a t into a dir.

val with_extension : string -> t -> bool

with_extension ext path returns true if path ends with ext false otherwise, ie: with_extension "html" "index.html" returns true but with_extenstion "html" "foohtml" returns false.

val basename : t -> t

Keep the filename and remove the path.

val add_extension : t -> string -> t

Add an extension to a t. For example: add_extension "index.txt" "html" will produce "index.txt.html".

val remove_extension : t -> t

Remove the extension of a path.

val replace_extension : t -> string -> t

Replace the extension of a path.

OCaml

Innovation. Community. Security.