을 VB.NET하지, 어떻게이 작업을 수행 할 수 있습니다 도움이 될 수 있습니다. 이 같은. 문자열은 변경되지 않기 때문에 수정 된 값으로 새 문자열을 반환하므로 이전 문자열에 할당해야합니다.
Module Module1
Sub Main()
Dim test As String = "The <field1> is mandatory"
Dim variable As String = "Employee Id"
test = test.Replace("<field1>", variable)
Console.WriteLine(test)
Console.ReadLine()
End Sub
End Module
당신은 또한 다음 문자열의 필드를 포함 변수로 교체 할 수 composite formatting를 사용하는 String.Format 방법을 사용할 수 있습니다. 이 같은.
Dim test As String = "The {0} is a mandatory {1}"
Dim variable As String = "Employee Id"
Dim variable2 As String = "Field"
test = String.Format(test, variable, variable2)