如何在 C# 中编写代表性别男性的符号
How to write symbol in c# that represents the gender masculine
我不想在 C# 代码中连接一些 ID 以导出到特定数据库。问题是数据库使用特定符号来连接 id。使用的符号就像男性的符号(像这样:♂)。如果我尝试在此处复制,我只会得到“0”字符。我也试图找到他的 ascii 码,但我找不到。我通过从 file maker pro 数据库中导出数据来获取符号。
我想要的是在 C# 中创建一个由这个奇怪符号连接的 id 数组。例如:12[symbol]123[symbol]
记住,ascii 是我们在 1970 年代使用的。您需要 Unicode 代码点,而不是 ascii 代码。如果你不明白其中的区别,那么在你写更多代码之前停止你正在做的一切并阅读这篇文章:
http://www.joelonsoftware.com/articles/Unicode.html
火星符号是 Unicode 代码点 u2642,因此在 C# 中会是
string mars = "\u2642";
当您以某种方式获得符号后,只需将其粘贴到您的源代码中即可:
string m = "♂";
The symbol a little different that this: ♂. The circle is smaller and the arrow is bigger
尽管 Unicode space 中的符号有 2 种变体并非不可能,但外观上的差异可能是由于不同的字体。
Still don't known the code for the symbol
正如几个人在这里发布的那样,代码是 2642,C# 表示法是 "Male(\u2642)"
或简称 type/paste "Male(♂)"
我不想在 C# 代码中连接一些 ID 以导出到特定数据库。问题是数据库使用特定符号来连接 id。使用的符号就像男性的符号(像这样:♂)。如果我尝试在此处复制,我只会得到“0”字符。我也试图找到他的 ascii 码,但我找不到。我通过从 file maker pro 数据库中导出数据来获取符号。 我想要的是在 C# 中创建一个由这个奇怪符号连接的 id 数组。例如:12[symbol]123[symbol]
记住,ascii 是我们在 1970 年代使用的。您需要 Unicode 代码点,而不是 ascii 代码。如果你不明白其中的区别,那么在你写更多代码之前停止你正在做的一切并阅读这篇文章:
http://www.joelonsoftware.com/articles/Unicode.html
火星符号是 Unicode 代码点 u2642,因此在 C# 中会是
string mars = "\u2642";
当您以某种方式获得符号后,只需将其粘贴到您的源代码中即可:
string m = "♂";
The symbol a little different that this: ♂. The circle is smaller and the arrow is bigger
尽管 Unicode space 中的符号有 2 种变体并非不可能,但外观上的差异可能是由于不同的字体。
Still don't known the code for the symbol
正如几个人在这里发布的那样,代码是 2642,C# 表示法是 "Male(\u2642)"
或简称 type/paste "Male(♂)"