Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use this in the immediate window:</p> <pre><code>str.Contains("\u8203"); </code></pre> <p>Or put it in the watch window so you'll just have to click the refresh button near the watched value to see the result, rather than re-entering it to the immediate (although you can always press up and then enter to re-enter the last command!)</p> <p>To check for ANY hidden character, you can either have a static array with all hidden characters and check:</p> <pre><code>HIDDENS.Any(c =&gt; str.Contains(c.ToString()) </code></pre> <p>And preferable even save the hidden characters as one-length strings and then do:</p> <pre><code>HIDDENS.Any(str.Contains) </code></pre> <p>OR you could be really sophisticated and do THIS:</p> <pre><code>private static readonly Bitmap BMP = new Bitmap(1000, 1000); private static readonly Graphics GRAPHICS = Graphics.FromImage(BMP); private static readonly Font FONT = new Font("Arial", 20); private static readonly RectangleF RECT = new RectangleF(0, 0, 1000, 1000); public static bool CheckInvisibleChars(string text) { var stringFormat1 = new StringFormat(StringFormatFlags.MeasureTrailingSpaces); stringFormat1.SetMeasurableCharacterRanges( Enumerable.Range(0, text.Length - 2).Select(i =&gt; new CharacterRange(i, 1)).ToArray()); return GRAPHICS.MeasureCharacterRanges(text, FONT, RECT, stringFormat1).Any( reg =&gt; reg.GetBounds(GRAPHICS).Width.Equals(0f)); } </code></pre> <p>From here it should also be easy to return information about each hidden character, etc.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload