Can I do something like "%s said %s blah.", $name, $blah;
in VB.NET?
It's getting painful writing name & "said" & blah & "blah"
.
PowerShell has another option that is easier. You can specify your variables directly in the strings. $message = "Hello, $first $last." The type of quotes you use around the string makes a difference.
To create a string, put the sequence of characters inside either single quotes, double quotes, or triple quotes and then assign it to a variable. You can look into how variables work in Python in the Python variables tutorial. For example, you can assign a character 'a' to a variable single_quote_character .
In VB.NET 14 (for VS2015), you can use string interpolation:
Dim newString As String = $"{name} said {blah} blah."
Yup, use String.Format:
Dim newString As String = String.Format("{0} said {1} blah.", name, blah)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With