For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/strings/replace.md.

replace

Replaces all occurrences of a search string with a replacement string.

Signature

replace(str: string, search: string, replace: string) -> string

Parameters

ParameterTypeRequiredDescription
str, search, replacestring, string, stringyesSource, search, replacement

Return value

Returns the documented result for the function signature.

Example

respond { status = 200, body = { slug = replace(lower(ctx.request.body.name), " ", "-") } }