Skip to content

Commit

Permalink
Merge pull request #2442 from yawaramin/js-string-replace-doc
Browse files Browse the repository at this point in the history
Js.String.replace: add doc comment
  • Loading branch information
bobzhang committed Jan 15, 2018
2 parents 2b34a26 + f67dc66 commit 16d255e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions jscomp/others/js_string.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ external normalizeByForm : t -> t = "normalize" [@@bs.send.pipe: t] (** ES2015 *
external repeat : int -> t = "" [@@bs.send.pipe: t] (** ES2015 *)

external replace : t -> t -> t = "" [@@bs.send.pipe: t]

(** [replace substr newSubstr string] returns a new string which is
identical to [string] except with the first matching instance of [substr]
replaced by [newSubstr].
[substr] is treated as a verbatim string to match, not a regular
expression.
@example {[
let result = Js.String.replace "a" "b" "aaaa"
let () = Js.log result (* prints "baaa" *)
]}
*)

external replaceByRe : Js_re.t -> t -> t = "replace" [@@bs.send.pipe: t]

(** returns a new string with some or all matches of a pattern replaced by the
Expand Down

0 comments on commit 16d255e

Please sign in to comment.