Skip to content

String manipulations in templates #18

@romz-pl

Description

@romz-pl

Hi,

In my opinion it would be valuable to have (by default) the string manipulations in template.
In particular, I would like to call following code in template file:

{{range .Messages}}
{{$nn := .Name}}
{{$w = string.replace($nn, 'AAA', 'bbb')}}
{{end}}

As a result I would like to get string $w with all replaced string 'AAA' with 'bbb' in string $nn.
Could you suggest the solution for this problem?

Kind regards,
Zbigniew Romanowski
romz@wp.pl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions