文字列の中に中括弧(「{」、「}」)を使って、プレイスホルダを作っておき、任意の文字列に置換するには、
String.Fromat() メソッドを使うと便利です。
Sub Main(ByVal args() As String)
Dim strMessage As String = "Hello! {0}. Do you like {1} ?"
strMessage = String.Format(strMessage, args(0).ToString(), args(1).ToString())
Console.WriteLine(strMessage)
End Sub
引数は2つ指定するものとし、それ以外の場合の処理は記述していません。
これを実行すると以下のようになります。
C:\>usePlaceholder Bill football
Hello! Bill. Do you like football ?
C:\>usePlaceholder Catherine "the cake"
Hello! Catherine. Do you like the cake ?
C:\>usePlaceholder Mary me
Hello! Mary. Do you like me ?