Display string in the UI text in specific format

Hello!
I have faced specific problem and don’t know how should i start working on it.
There is a string, example: “Player1, please tell Player2 to call me”
How can i display this string in UI text, if users have input their names so it would looks like this
“Bob, please tell James to call me”.

Thank you.

Assuming you have a UI.Text text, and string Player1 and string Player2 set as string variables, you can use string.Format (), like this :

text.text = string.Format ("{0}, please tell {1} to call me", Player1, Player2);