How to concate two string on Swig?

68 views Asked by At

I am trying to concate a variable with another string but failed to do so. Till now i tried these things but failed.

{{name~' Leon'}} and {{name+' Leon'}}

remember i am trying to do it in swig not in twig.

2

There are 2 answers

0
kjones On

Are you able to do it this way?

{{ name }} Leon
0
Ling On

SWIG itself comes with a macro (in typemaps/fragments.swg)

#define %fragment_name(Name, Type...)     %string_name(Name) "_" {Type}

Maybe you can try something similar.