In VB.net or any programming language, if the program requires getting data from external programs, results or data from third party software that needs to be processed may or may not have expected desired output.
For example, getting a string from a third party software. String is quite straight forward and it's quite basic.
But the issue arises, if the desired output requires a specific string or text and other text should be discarded or deleted. Regex or any other methods might help on getting the specific text or data.
One basic issue, if the string needs to be formatted in one line but a line feed or a new line keeps breaking the line.
The first instinct that I think of, is to use "Trim" function but it doesn't solve the issue. Trim, Ltrim or Rtrim just delete spaces but it doesn't delete line feed.
In VB.Net a line feed can easily be removed by this code snippet below:
Dim strNoLineFeed As String = String_with_Line_Feed.Replace(vbCr, "").Replace(vbLf, "")
It's quite easy and simple, but line feed is not visible unless some word editor is used and if the instinct or quick thinking doesn't kick-in, it will take some of your precious time.
Same logic will apply to any programming language, but of course the code or the way to remove line feed will be different from the code above.
Cheers..till next time.. Enjoy coding..
Free Android Apps:
links below to find out more:
Multiplication Table for early learners
Catholic Rosary Guide for Android:
Divine Mercy Chaplet Guide (A Powerful prayer):