Skip to main content

strings.Replace

Replace first n occurrences (-1 for all)

strings.Replace(s: string, old: string, new: string, n: int) -> string

Arguments

NameType
sstring
oldstring
newstring
nint

Example

{{ strings.Replace("hello", "l", "L", 1) }}

Returns "heLlo".