String "format"?

Hi!

Instead of “formatting” a string like this:

string info = name + "costs" + price + " $";

I remember some time ago I came across a string, that looked something like this:

**string info = “{0} costs {1} ";** (where {0} was a string and {1} was a float, and it became "Car costs 10 ”)

If anyone understands what I’m talking about, how do you set this alternate way of doing it up?

String.Format

e.g.

Debug.Log(string.Format("Test: {0}, {1}", 10, 20));

As of Unity 5.0 there’s a new function in Debug just for this,
Debug.LogFormat, similar to Console.WriteLine in .NET:

Debug.LogFormat ("Test: {0}", 10);