C#StringString.Format

Replaces the format items in a string with the string representation of given objects.

문법

String.Format(format, args)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

string
name
result
String
Console
WriteLine
string name = "Alice";
int age = 30;
string result = String.Format("Name: {0}, Age: {1}", name, age);
Console.WriteLine(result);   // "Name: Alice, Age: 30"