Best way to emulate Swift String Interpolation in UnityScript?

Hello,

I’ve been recently reading up on Swift for other projects and really like how they implement string interpolation - I have always wanted something like this for UnityScript.

Anyone know of any similar methods/options for that? It’d be really useful when writing generative dialog/storytelling, for example, to just plug vars in, rather than say, concatenating.

Thanks in advance, and all feedback welcome!

Pat

use string.Format.

var someBool: Boolean = false;
var someInt: Int = 102;
var someFloat: Float = 103.0f;

function SomeFunction()
{
  var aString: String = string.Format("This is a bool value: {0}

This is an Int value: {1}
This is a float value: {2}
This is the Int value again: {1}", someBool, someInt, someFloat);
}

The numbers between the curly braces are the index of the parameters starting with someBool in the above case, the values can be reused as their index value.