How to interpolate multiline string?

Hi guys, I have not found examples so far about this:

is it possible to return an interpolated string with the variables’ actual values?

supposing we have a multiline string like so:

placeHoldersString := `Your name: %s \n
    Your city: %s
    Your country: %s`

Can I use filledString := fmt.Sprintf(placeHoldersString, name, city, country) to return

Your name: John Doe
Your city: New Jersey
Your country: USA

Or something similar…, or I should take another approach? :thinking:


We would need some more context to know if you should take another approach or not!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.