This question is for C Sharp (and Java maybe :).
When I want to display a message to the console, I want to insert after each "+" a blank space. How can I do this, without inserting manually that blank space?
We can also concatenate the strings by using the space ' ' in between the two strings, and the “+” operator is used to concatenate the string with space. To get the output, I have used print(my_str).
Concatenating with an Empty String Variable You can use the concat() method with an empty string variable to concatenate primitive string values. By declaring a variable called totn_string as an empty string or '', you can invoke the String concat() method to concatenate primitive string values together.
try this
var text = string.Join(" ", new[] {foo, bar, other });
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