substitute

Substitute all instances of match from source. Set replacement to null in order to remove instead of replace (or use the remove() function, below).

Template params: T = type of array element

  1. T[] substitute(T[] source, T[] match, T[] replacement, Buffer!(T) result)
    T[]
    substitute
    (
    T
    )
    (
    in T[] source
    ,
    in T[] match
    ,,
    ref Buffer!(T) result
    )
  2. T[] substitute(T[] source, T[] match, T[] replacement, T[] result)

Parameters

match T[]

pattern to match in source array

replacement T[]

pattern to replace matched sub-arrays

result Buffer!(T)

buffer to write resulting array to

Return Value

Type: T[]

result

Examples

Buffer!(char) result;
substitute("some string", "ring", "oops", result);
test!("==")(result[], "some stoops");

Meta