Text Visualizer

aronmatthew

Active member
Joined
Aug 5, 2019
Messages
41
Programming Experience
Beginner
I'm having a problem after a new install of visual studio. I cant see any newline chars ext.. in the text visualizer. Here is my current version.
Microsoft Visual Studio Community 2022
Version 17.10.4
VisualStudio.17.Release/17.10.4+35027.167
Microsoft .NET Framework
Version 4.8.09032
postTemp.png
 
That is correct behavior. The text visualizer is supposed to show you the text as how it would be displayed. It is not a hex editor.

I get the same behavior:
1722906085930.png
 
The problem that I'm having is when trying to copy text from a richTextBox it seems to contain unknown chars at the end resulting in many new lines.
 
... The visualizer was showing you these new lines. Notice how the caret is several lines below the rest of the text when you put the focus is the visualizer:
1722914173274.png
 
Anyway, to see all characters in the string. Open the Immediate window and type in CopyToolText.ToCharArray().

Example:
1722915382388.png
 
As an aside, there is no need to do this:
C#:
CopyToolLabel = CopyToolLabel.Trim(' ');
CopyToolLabel = CopyToolLabel.Trim('\r');
CopyToolLabel = CopyToolLabel.Trim('\n');

You could simply do:
C#:
CopyToolLabel = CopyToolLabel.Trim();
which will remove all leading and trailing whitespace. The characters ' ', '\r', '\n' are considered whitespace characters.
 

Latest posts

Back
Top Bottom