Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				
nibor46056yDoes vb.net have string interpolation, like c#?
Like
$"data: {serialdata.Trimend()}"
Also aren't strings immutable? So. Trimend() can't change the string it is operating on? - 
				
				@nibor I (still) have to, but my resignation letter is basically out, only a few more months of dealing with this clusterfuck :)
String interpolation was apparently added in newer versions, but no chance when you're using 2010 Express Edition for production, since it's free...
Also I think strings are immutable, but so what? TrimEnd would probably just create a new string in memory and throw away the reference to the previous one... - 
				
				
nibor46056y@ninjasloth the original string won't be freed up by the garbage collector as long as there is a reference to it. So if you do
trimmedSerialData = serialData. Trimend()
The serialData value will still be valid and present. 
Related Rants

isLucky = true;
✘ Lie
✘ Lie
✘ Lie
The moment you realize the .net Framework's String.TrimEnd() method will actually modify your String prior to returning it, and there seems to be no convenient way of getting a copy without declaring a new variable...
Just wanted to get rid of excess empty lines in the log caused by trailing <CR><LF> when receiving lines of serial data:
Console.WriteLine(DateTime.Now.ToString("H:m:s.fff") + " - serial data received on " + com_port + ": " + serial_data.TrimEnd())
But suddenly the parser could not find its termination characters anymore...
Resulting in probably the most disgusting parentheses I had ever added to any code:
Console.WriteLine(DateTime.Now.ToString("H:m:s.fff") + " - serial data received on " + com_port + (": " + serial_data).TrimEnd())
Yes, I feel bad about it, but then again is VB .net and it kinda "works for me". I promise I will (try to remember to) remove these as soon as debugging is done...
devrant
string
.net
vb