Can I do something like "%s said %s blah.", $name, $blah;
in VB.NET?
It's getting painful writing name & "said" & blah & "blah"
.
In VB.NET 14 (for VS2015), you can use string interpolation:
Dim newString As String = $"{name} said {blah} blah."
String.Format
call so the format string can become a variable or function to retrieve from a resource file, etc.
Dec 23, 2015 at 1:35
public string Format(FormattableString fs) { // Get localized version of the default language string: var localFormat = GetLocalized(fs.Format); // Feed the resulting format string into String.Format: return String.Format(localFormat, fs.GetArguments()); }
String.Format
or "this" &/+ "that"
IMO. I'm adopting it wholesale.
Oct 11, 2018 at 4:22
Yup, use String.Format:
Dim newString As String = String.Format("{0} said {1} blah.", name, blah)