replace

Performs a linear scan of buf from [0 .. buf.length$(RP), replacing occurrences of pat with val. Comparisons will be performed using the supplied predicate or '==' if none is supplied.

  1. size_t replace(Elem[] buf, Elem pat, Elem val, Pred2E pred)
    version(TangoDoc)
    replace
  2. template replace(Buf, Elem)
  3. template replace(Buf, Elem, Pred)

Parameters

buf Elem[]

The array to scan.

pat Elem

The pattern to match.

val Elem

The value to substitute.

pred Pred2E

The evaluation predicate, which should return true if e1 is equal to e2 and false if not. This predicate may be any callable type.

Return Value

Type: size_t

The number of elements replaced.

Meta