Skip to main content

replace

Function replace 

Source
pub fn replace<A: Text, B: Number, C: Number, D: Text>(
    t: A,
    start: B,
    count: C,
    new: D,
) -> FnText4<A, B, C, D>
Expand description

Returns text where an old text is substituted with a new text.

documentfoundation->REPLACE

Syntax:

    REPLACE( T: Text; Start: Number; Count: Number; New: Text )

Constraints: Start ≥ 1.

Semantics: Returns text T, but remove the characters starting at character position Start for Count characters, and instead replace them with New. Character positions defined by Start begin at 1 (for the leftmost character). If Count=0, the text New is inserted before character position Start, and all the text before and after Start is retained. If Start > length of text T (TLen) then Start is set to TLen. If Count > TLen - Start then Count is set to TLen - Start.

REPLACE(T;Start;Len;New) is the same as LEFT(T;Start - 1) & New & MID(T; Start + Len; LEN(T)))

See also: crate::of::left(), crate::of::len(), crate::of::mid(), crate::of::right(), crate::of::substitute(),