Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Created October 23, 2016 06:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufcpp/84c61d0d2447a35d6c0c2b24914faea9 to your computer and use it in GitHub Desktop.
Save ufcpp/84c61d0d2447a35d6c0c2b24914faea9 to your computer and use it in GitHub Desktop.
zero width joiner is ignored in identifiers
using System;
class Program
{
static void Main()
{
var ab = 0;
a\u200db = 1; // なぜか ab と同じ扱い。\u200d は zero witdh joiner
Console.WriteLine(ab); // 1
var s1 = "ab";
var s2 = "a\u200db";
Console.WriteLine(s1.Length); // 2
Console.WriteLine(s2.Length); // 3
Console.WriteLine(s1 == s2); // false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment